diff --git a/Makefile b/Makefile index 1e82c6e0..4b2b4df6 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,11 @@ lint: .PHONY: test test: - TZ=Asia/Singapore pytest --cov=arq && coverage combine + TZ=Asia/Singapore pytest --cov=arq .PHONY: testcov testcov: - TZ=Asia/Singapore pytest --cov=arq && (echo "building coverage html"; coverage combine; coverage html) + TZ=Asia/Singapore pytest --cov=arq && (echo "building coverage html"; coverage html) .PHONY: all all: testcov lint diff --git a/arq/worker.py b/arq/worker.py index 046595ee..6f4351ae 100644 --- a/arq/worker.py +++ b/arq/worker.py @@ -100,7 +100,7 @@ def __init__(self, *, self.queues: Optional[List[str]] = queues self.timeout_seconds = timeout_seconds or self.timeout_seconds - self._shadow_lookup: Dict[str, Actor] = {} + self._shadow_lookup: Dict[str, Actor] = {} self.start: Optional[float] = None self.last_health_check = 0 self._last_health_check_log = None diff --git a/demo/requirements.txt b/demo/requirements.txt index 6e68e196..8705171e 100644 --- a/demo/requirements.txt +++ b/demo/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.3.2 -aiohttp-session==2.5.1 -chevron==0.12.1 -uvloop==0.10.2 +aiohttp==3.4.4 +aiohttp-session==2.7.0 +chevron==0.13.1 +uvloop==0.11.3 diff --git a/docs/requirements.txt b/docs/requirements.txt index 44055550..3e85d58e 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,4 @@ docutils==0.14 Pygments==2.2.0 -Sphinx==1.7.5 +Sphinx==1.8.1 sphinxcontrib-websupport==1.1.0 diff --git a/setup.cfg b/setup.cfg index c5e2f665..fa2aa8ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,10 +5,13 @@ timeout = 5 filterwarnings = error ignore::DeprecationWarning:isort.settings + ignore::ImportWarning:msgpack [flake8] max-complexity = 10 max-line-length = 120 +# remove E252 once https://github.com/PyCQA/pycodestyle/issues/753 is released +ignore = E252 [bdist_wheel] python-tag = py35+ diff --git a/tests/requirements.txt b/tests/requirements.txt index b552815a..8dcfd70d 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,16 +1,16 @@ coverage==4.5.1 docutils==0.14 -flake8==3.5.0 +flake8==3.6.0 isort==4.3.4 -mypy==0.610 -pycodestyle==2.3.1 +mypy==0.641 +pycodestyle==2.4.0 pyflakes==2.0.0 -pytest==3.6.2 +pytest==3.9.3 pytest-aiohttp==0.3.0 -pytest-cov==2.5.1 -pytest-isort==0.2.0 +pytest-cov==2.6.0 +pytest-isort==0.2.1 pytest-mock==1.10.0 -pytest-sugar==0.9.1 -pytest-timeout==1.3.0 +pytest-sugar==0.9.2 +pytest-timeout==1.3.2 pytest-toolbox==0.4 -pytz==2018.5 +pytz==2018.7 diff --git a/tests/test_cli.py b/tests/test_cli.py index 824bbb77..828d3588 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -21,7 +21,7 @@ def test_simple_burst(tmpworkdir, monkeypatch): runner = CliRunner() result = runner.invoke(cli, ['--burst', 'test.py']) assert result.exit_code == 0 - output = re.sub('\d+:\d+:\d+', 'TIME', result.output) + output = re.sub(r'\d+:\d+:\d+', 'TIME', result.output) assert output == ('TIME MainProcess: starting work process "WorkProcess"\n' 'TIME MainProcess: worker process exited ok\n') @@ -37,7 +37,7 @@ def test_worker_exited_badly(tmpworkdir, monkeypatch): runner = CliRunner() result = runner.invoke(cli, ['--burst', 'test.py']) assert result.exit_code == 3 - output = re.sub('\d+:\d+:\d+', 'TIME', result.output) + output = re.sub(r'\d+:\d+:\d+', 'TIME', result.output) assert ('TIME MainProcess: starting work process "WorkProcess"\n' 'TIME MainProcess: worker process 123 exited badly with exit code 42\n') == output diff --git a/tests/test_customisation.py b/tests/test_customisation.py index 01f7538a..9e020fc7 100644 --- a/tests/test_customisation.py +++ b/tests/test_customisation.py @@ -92,7 +92,7 @@ class DifferentQueuesActor(DemoActor): worker = DatetimeWorker(loop=loop, burst=True, shadows=[DemoActor, DemoActor, DifferentQueuesActor]) with pytest.raises(TypeError) as excinfo: await worker.run() - msg = re.sub('0x\w+>', '0x123>', excinfo.value.args[0]) + msg = re.sub(r'0x\w+>', '0x123>', excinfo.value.args[0]) assert msg == (" has a different " "list of queues to the first shadow: ('dft', 'foobar') != ('high', 'dft', 'low')") await worker.close() diff --git a/tests/test_main.py b/tests/test_main.py index 45de7b7b..0e555046 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -62,8 +62,8 @@ async def test_dispatch_work(tmpworkdir, loop, caplog, redis_conn): assert not tmpworkdir.join('add_numbers').exists() await worker.run() assert tmpworkdir.join('add_numbers').read() == '3' - log = re.sub('0.0\d\ds', '0.0XXs', caplog.log) - log = re.sub("arq:quit-.*", "arq:quit-", log) + log = re.sub(r'0.0\d\ds', '0.0XXs', caplog.log) + log = re.sub(r"arq:quit-.*", "arq:quit-", log) log = re.sub(r'\d{4}-\d+-\d+ \d+:\d+:\d+', '', log) log = re.sub(r'\w{3}-\d+ \d+:\d+:\d+', '', log) print(log) @@ -102,9 +102,9 @@ async def test_handle_exception(loop, caplog): worker = MockRedisWorker(burst=True, loop=actor.loop) worker.mock_data = actor.mock_data await worker.run() - log = re.sub('0.0\d\ds', '0.0XXs', caplog.log) - log = re.sub(', line \d+,', ', line ,', log) - log = re.sub('"/.*?/(\w+/\w+)\.py"', r'"/path/to/\1.py"', log) + log = re.sub(r'0.0\d\ds', '0.0XXs', caplog.log) + log = re.sub(r', line \d+,', ', line ,', log) + log = re.sub(r'"/.*?/(\w+/\w+)\.py"', r'"/path/to/\1.py"', log) log = re.sub(r'\d{4}-\d+-\d+ \d+:\d+:\d+', '', log) log = re.sub(r'\w{3}-\d+ \d+:\d+:\d+', '', log) print(log) @@ -144,7 +144,7 @@ class BadActor(Actor): async def test_custom_name(loop, caplog): actor = FoobarActor(loop=loop) - assert re.match('^$', str(actor)) + assert re.match(r'^$', str(actor)) await actor.concat('123', '456') worker = MockRedisWorker(burst=True, loop=actor.loop, shadows=[FoobarActor]) worker.mock_data = actor.mock_data @@ -160,7 +160,7 @@ async def test_call_direct(mock_actor_worker, caplog): await worker.run() assert worker.jobs_failed == 0 assert worker.jobs_complete == 1 - log = re.sub('0.0\d\ds', '0.0XXs', caplog.log) + log = re.sub(r'0.0\d\ds', '0.0XXs', caplog.log) assert ('arq.jobs: dft queued 0.0XXs → __id__ MockRedisDemoActor.direct_method(1, 2)\n' 'arq.jobs: dft ran in 0.0XXs ← __id__ MockRedisDemoActor.direct_method ● 3') in log diff --git a/tests/test_worker.py b/tests/test_worker.py index cfb0f221..4b51d2f6 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -31,7 +31,7 @@ async def test_long_args(mock_actor_worker, caplog): v = ','.join(map(str, range(20))) await actor.concat(a=v, b=v) await worker.run() - log = caplog(('0.0\d\ds', '0.0XXs')) + log = caplog((r'0.0\d\ds', '0.0XXs')) print(log) assert ("dft queued 0.0XXs → __id__ MockRedisDemoActor.concat" "(a='0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19', b='0,1,2,3,4,5,6,7,8,9,1…)\n") in log @@ -45,7 +45,7 @@ async def test_longer_args(mock_actor_worker, caplog): v = ','.join(map(str, range(20))) await actor.concat(a=v, b=v) await worker.run() - log = caplog(('0.0\d\ds', '0.0XXs')) + log = caplog((r'0.0\d\ds', '0.0XXs')) assert ("dft queued 0.0XXs → __id__ MockRedisDemoActor.concat" "(a='0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19', b='0,1,2,3,4,5,6,7,8,9,10,11,12,13…)\n") in log assert ("dft ran in 0.0XXs ← __id__ MockRedisDemoActor.concat ● " @@ -58,7 +58,7 @@ async def test_stop_job_normal(mock_actor_worker, caplog): await actor.stop_job_normal() await worker.run() assert ('arq.jobs INFO: dft ran in 0.0XXs ■ __id__ MockRedisDemoActor.stop_job_normal ● Stopped ' - 'stopping job normally') in caplog(('0.0\d\ds', '0.0XXs')) + 'stopping job normally') in caplog((r'0.0\d\ds', '0.0XXs')) async def test_stop_job_warning(mock_actor_worker, caplog): @@ -67,7 +67,7 @@ async def test_stop_job_warning(mock_actor_worker, caplog): await actor.stop_job_warning() await worker.run() assert ('arq.jobs WARNING: dft ran in 0.0XXs ■ __id__ MockRedisDemoActor.stop_job_warning ● Stopped Warning ' - 'stopping job with warning') in caplog(('0.0\d\ds', '0.0XXs')) + 'stopping job with warning') in caplog((r'0.0\d\ds', '0.0XXs')) async def test_separate_log_levels(mock_actor_worker, caplog): @@ -75,7 +75,7 @@ async def test_separate_log_levels(mock_actor_worker, caplog): actor, worker = mock_actor_worker await actor.concat(a='1', b='2') await worker.run() - log = caplog(('0.0\d\ds', '0.0XXs')) + log = caplog((r'0.0\d\ds', '0.0XXs')) assert ('arq.work: Initialising work manager, burst mode: True, creating shadows...\n' 'arq.work: Running worker with 1 shadow listening to 3 queues\n' 'arq.work: shadows: MockRedisDemoActor | queues: high, dft, low\n'