Skip to content

Commit 9600559

Browse files
authored
support python 3.10 (#298)
* support python 3.10, fix #282 * fix get_event_loop usage
1 parent 77031fd commit 9600559

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
fail-fast: false
5050
matrix:
5151
os: [ubuntu]
52-
python-version: ['3.7', '3.8', '3.9']
52+
python-version: ['3.7', '3.8', '3.9', '3.10']
5353

5454
env:
5555
PYTHON: ${{ matrix.python-version }}

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'Programming Language :: Python :: 3.7',
3535
'Programming Language :: Python :: 3.8',
3636
'Programming Language :: Python :: 3.9',
37+
'Programming Language :: Python :: 3.10',
3738
'Topic :: Internet',
3839
'Topic :: Software Development :: Libraries :: Python Modules',
3940
'Topic :: System :: Clustering',

tests/conftest.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
@pytest.fixture(name='loop')
1313
def _fix_loop(event_loop):
14-
asyncio.set_event_loop(event_loop)
1514
return event_loop
1615

1716

tests/test_cli.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def test_help():
2020
assert result.output.startswith('Usage: arq [OPTIONS] WORKER_SETTINGS\n')
2121

2222

23-
def test_run(cancel_remaining_task):
23+
def test_run(cancel_remaining_task, mocker, loop):
24+
mocker.patch('asyncio.get_event_loop', lambda: loop)
2425
runner = CliRunner()
2526
result = runner.invoke(cli, ['tests.test_cli.WorkerSettings'])
2627
assert result.exit_code == 0

tests/test_worker.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ async def fails(ctx):
3333
raise TypeError('my type error')
3434

3535

36-
def test_no_jobs(arq_redis: ArqRedis, loop):
36+
def test_no_jobs(arq_redis: ArqRedis, loop, mocker):
3737
class Settings:
3838
functions = [func(foobar, name='foobar')]
3939
burst = True
4040
poll_delay = 0
4141
queue_read_limit = 10
4242

4343
loop.run_until_complete(arq_redis.enqueue_job('foobar'))
44-
asyncio.set_event_loop(loop)
44+
mocker.patch('asyncio.get_event_loop', lambda: loop)
4545
worker = run_worker(Settings)
4646
assert worker.jobs_complete == 1
4747
assert str(worker) == '<Worker j_complete=1 j_failed=0 j_retried=0 j_ongoing=0>'

0 commit comments

Comments
 (0)