Skip to content

Commit 01809f6

Browse files
committed
Set COVERAGE_CORE=sysmon to speed up 3.12 tests
1 parent 8f167c0 commit 01809f6

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ jobs:
6666
- name: Install dependencies
6767
run: uv sync --upgrade-package 'redis${{ matrix.backend.redis-py-version }}'
6868

69+
- name: Set COVERAGE_CORE for Python 3.12
70+
if: ${{ matrix.python-version == '3.12' }}
71+
run: |
72+
echo "COVERAGE_CORE=sysmon" >> $GITHUB_ENV
6973
- name: Run tests
7074
env:
7175
REDIS_VERSION: ${{ matrix.backend.redis-version }}

tests/cli/test_snapshot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async def test_snapshot_with_mixed_tasks(docket: Docket):
9696
future = datetime.now(timezone.utc) + timedelta(seconds=5)
9797
await docket.add(tasks.trace, when=future)("hi!")
9898
for _ in range(5): # more than the concurrency allows
99-
await docket.add(tasks.sleep)(4)
99+
await docket.add(tasks.sleep)(2)
100100

101101
async with Worker(docket, name="test-worker", concurrency=2) as worker:
102102
worker_running = asyncio.create_task(worker.run_until_finished())
@@ -187,10 +187,10 @@ async def test_snapshot_with_stats_flag_mixed_tasks(docket: Docket):
187187

188188
# Add multiple tasks of different types
189189
future = datetime.now(timezone.utc) + timedelta(seconds=5)
190-
await docket.add(tasks.trace, when=future, key="trace-1")("hi!")
191-
await docket.add(tasks.trace, when=future, key="trace-2")("hello!")
190+
await docket.add(tasks.trace, when=future)("hi!")
191+
await docket.add(tasks.trace, when=future)("hello!")
192192
for _ in range(3):
193-
await docket.add(tasks.sleep, key=f"sleep-{_}")(4)
193+
await docket.add(tasks.sleep)(2)
194194

195195
async with Worker(docket, name="test-worker", concurrency=2) as worker:
196196
worker_running = asyncio.create_task(worker.run_until_finished())
@@ -206,7 +206,7 @@ async def test_snapshot_with_stats_flag_mixed_tasks(docket: Docket):
206206
assert result.exit_code == 0, result.output
207207

208208
# Should show the normal summary
209-
assert "1 workers, 2/5 running" in result.output, result.output
209+
assert "1 workers, 2/5 running" in result.output
210210

211211
# Should show task statistics table with enhanced columns
212212
assert "Task Count Statistics by Function" in result.output

tests/cli/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ async def run_cli(
2222
) -> CliResult:
2323
"""Run `python -m docket ...` and capture output."""
2424
merged_env = {**os.environ, "PYTHONUNBUFFERED": "1"} | (env or {})
25+
if sys.version_info >= (3, 12) and sys.version_info < (3, 13):
26+
merged_env.setdefault("COVERAGE_CORE", "sysmon")
2527

2628
same_python = sys.executable
2729
has_pytest_cov = any(k.startswith("COV_CORE_") for k in merged_env)

0 commit comments

Comments
 (0)