Skip to content

Commit 8ad4f01

Browse files
authored
Move to pytest-asyncio to fix test failures for 3.14 (#174)
1 parent f6ec2c6 commit 8ad4f01

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
87
workflow_call:
98

109
jobs:
@@ -14,7 +13,7 @@ jobs:
1413
strategy:
1514
fail-fast: false
1615
matrix:
17-
python-version: ["3.10", "3.11", "3.12", "3.13"]
16+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1817
backend:
1918
- name: "Redis 6.2, redis-py <5"
2019
redis-version: "6.2"
@@ -44,6 +43,9 @@ jobs:
4443
- python-version: "3.13"
4544
cov-threshold: 100
4645
pytest-ignore: ""
46+
- python-version: "3.14"
47+
cov-threshold: 100
48+
pytest-ignore: ""
4749

4850
steps:
4951
- uses: actions/checkout@v4

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ classifiers = [
1717
"Programming Language :: Python :: 3.11",
1818
"Programming Language :: Python :: 3.12",
1919
"Programming Language :: Python :: 3.13",
20+
"Programming Language :: Python :: 3.14",
2021
"License :: OSI Approved :: MIT License",
2122
"Operating System :: OS Independent",
2223
"Typing :: Typed",
@@ -54,7 +55,7 @@ dev = [
5455
"pre-commit>=4.1.0",
5556
"pyright>=1.1.398",
5657
"pytest>=8.3.4",
57-
"pytest-aio>=1.9.0",
58+
"pytest-asyncio>=0.24.0",
5859
"pytest-cov>=6.0.0",
5960
"pytest-xdist>=3.6.1",
6061
"ruff>=0.9.7",
@@ -101,11 +102,10 @@ addopts = [
101102
"--cov-report=term-missing",
102103
"--cov-branch",
103104
]
104-
filterwarnings = [
105-
"error",
106-
"ignore:'asyncio.DefaultEventLoopPolicy' is deprecated:DeprecationWarning:pytest_aio",
107-
"ignore:'asyncio.set_event_loop_policy' is deprecated:DeprecationWarning:pytest_aio",
108-
]
105+
asyncio_mode = "auto"
106+
asyncio_default_fixture_loop_scope = "function"
107+
asyncio_default_test_loop_scope = "function"
108+
filterwarnings = ["error"]
109109

110110
[tool.coverage.run]
111111
omit = ["src/docket/__main__.py"]

tests/cli/test_snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
@pytest.fixture(autouse=True)
19-
async def empty_docket(docket: Docket, aiolib: str):
19+
async def empty_docket(docket: Docket):
2020
"""Ensure that the docket has been created"""
2121
future = datetime.now(timezone.utc) + timedelta(seconds=60)
2222
await docket.add(tasks.trace, key="initial", when=future)("hi")

tests/cli/test_striking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ async def test_strike_with_no_function_or_parameter(
226226
),
227227
],
228228
)
229-
async def test_interpret_python_value(input_value: str | None, expected_result: Any):
229+
def test_interpret_python_value(input_value: str | None, expected_result: Any):
230230
"""Should interpret Python values correctly from strings"""
231231
result = interpret_python_value(input_value)
232232
assert result == expected_result

tests/test_fundamentals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ async def task_with_timeout(
12311231
elapsed = datetime.now(timezone.utc) - start
12321232

12331233
assert called
1234-
assert timedelta(milliseconds=150) <= elapsed <= timedelta(milliseconds=300)
1234+
assert timedelta(milliseconds=150) <= elapsed <= timedelta(milliseconds=400)
12351235

12361236

12371237
async def test_timeout_is_compatible_with_retry(docket: Docket, worker: Worker):

uv.lock

Lines changed: 19 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)