Skip to content

Commit 46afe16

Browse files
committed
fix accidental rate limiting during tests
1 parent 14a8903 commit 46afe16

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: pipx install --python $(which python) tox
4444

4545
- name: Generate docs
46-
run: poetry tox -e docs
46+
run: poetry run tox -e docs
4747

4848
- name: Check if repo docs are up to date
4949
run: |

tests/test_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def event_loop():
2424

2525
@pytest_asyncio.fixture(autouse=True)
2626
async def async_code_is_too_fast_lol():
27-
"""Sleep for up to 0.1 seconds during each test to avoid getting rate limited."""
28-
await asyncio.sleep(random() / 10)
27+
"""Sleep for up to 0.2 seconds during each test to avoid getting rate limited."""
28+
await asyncio.sleep(random() / 5)
2929

3030

3131
class TestAsync:

tests/test_sync.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test the synchronous API functions. This module specifically tests API interaction,
22
not the underlying data structures. See tests/test_types.py for that."""
33

4+
from time import sleep
45
from typing import Any
56

67
import pytest
@@ -13,6 +14,13 @@
1314
qbr = Sync()
1415

1516

17+
@pytest.fixture(autouse=True)
18+
def anti_rate_limiting():
19+
"""Sleep for a short time to avoid getting rate limited. Apparently the sync code is
20+
still too fast."""
21+
sleep(0.07)
22+
23+
1624
class TestSync:
1725
"""Test synchronous API functions."""
1826

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ envlist =
1212
[testenv]
1313
allowlist_externals = poetry
1414
commands_pre =
15-
poetry install --no-root --sync
15+
poetry install
1616
commands =
1717
poetry run pytest
1818

0 commit comments

Comments
 (0)