Skip to content

Commit

Permalink
Added an env var to speedup the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flozz committed Sep 2, 2024
1 parent eb1da1d commit 8f69816
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/env.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Usage::
RIVALCFG_DRY=1


RIVALCFG_DEBUG_NO_COMMAND_DELAY
-------------------------------

When set, this remove the delay between commands. This is only usefull to allow tests to run faster, you may not use this with real devices, they may hang or even crash. See :py:attr:`~rivalcfg.mouse.Mouse.command_delay`.


RIVALCFG_PROFILE
----------------

Expand All @@ -26,3 +32,4 @@ Usage::
For example, to load the Rival 100 profile and list its CLI options::

RIVALCFG_PROFILE=1038:1702 RIVALCFG_DRY=1 rivalcfg --help

1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test(session):
"test",
env={
"RIVALCFG_DRY": "1",
"RIVALCFG_DEBUG_NO_COMMAND_DELAY": "1",
},
)

Expand Down
4 changes: 3 additions & 1 deletion rivalcfg/mouse.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import time

from . import usbhid
Expand Down Expand Up @@ -291,7 +292,8 @@ def _hid_write(
raise ValueError("Invalid HID report type: %2x" % report_type)

# Avoids sending multiple commands to quickly
time.sleep(self._command_approve_delay)
if "RIVALCFG_DEBUG_NO_COMMAND_DELAY" not in os.environ:
time.sleep(self._command_approve_delay)

def __getattr__(self, name):
# Handle every set_xxx methods generated from device's profiles
Expand Down

0 comments on commit 8f69816

Please sign in to comment.