Skip to content

Commit 59ba542

Browse files
authored
fix tests and uprev test dependencies (#288)
* fix tests and uprev test dependencies * fixing build * isort colours * uprev test deps * drop python 3.6 support * remove broken test * trying to fix tests 💩 * uprev dirty-equals * revent codecov breaking builds * uprev dirty-equals * fix cli tests * comments and reinstate test_redis_sentinel_failure test * fix for 3.7, formatting
1 parent e3979ce commit 59ba542

19 files changed

+165
-121
lines changed

.codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
coverage:
22
precision: 2
33
range: [95, 100]
4+
status:
5+
patch: false
6+
project: false
47

58
comment:
69
layout: 'header, diff, flags, files, footer'

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
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.6', '3.7', '3.8', '3.9']
52+
python-version: ['3.7', '3.8', '3.9']
5353

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

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DEFAULT_GOAL := all
22
isort = isort arq tests
3-
black = black -S -l 120 --target-version py37 arq tests
3+
black = black arq tests
44

55
.PHONY: install
66
install:
@@ -15,7 +15,7 @@ format:
1515

1616
.PHONY: lint
1717
lint:
18-
flake8 arq/ tests/
18+
flake8 --max-complexity 10 --max-line-length 120 --ignore E203,W503 arq/ tests/
1919
$(isort) --check-only --df
2020
$(black) --check
2121

arq/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def cli(*, worker_settings: str, burst: bool, check: bool, watch: str, verbose:
4343
else:
4444
kwargs = {} if burst is None else {'burst': burst}
4545
if watch:
46-
asyncio.get_event_loop().run_until_complete(watch_reload(watch, worker_settings_))
46+
asyncio.run(watch_reload(watch, worker_settings_))
4747
else:
4848
run_worker(worker_settings_, **kwargs)
4949

arq/connections.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,10 @@ async def pool_factory(*args: Any, **kwargs: Any) -> Redis:
266266
async def log_redis_info(redis: Redis, log_func: Callable[[str], Any]) -> None:
267267
with await redis as r:
268268
info_server, info_memory, info_clients, key_count = await asyncio.gather(
269-
r.info(section='Server'), r.info(section='Memory'), r.info(section='Clients'), r.dbsize(),
269+
r.info(section='Server'),
270+
r.info(section='Memory'),
271+
r.info(section='Clients'),
272+
r.dbsize(),
270273
)
271274

272275
redis_version = info_server.get('server', {}).get('redis_version', '?')

arq/version.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
__all__ = ['VERSION']
22

3-
VERSION = 'dev'
3+
# version is set automatically in CI before release,
4+
# see https://gist.github.com/samuelcolvin/da2f521da5d2195fbfd65da3b8f58589
5+
VERSION = '0.0.dev0'

arq/worker.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,13 @@ async def job_failed(exc: BaseException) -> None:
600600

601601
await asyncio.shield(
602602
self.finish_job(
603-
job_id, finish, result_data, result_timeout_s, keep_result_forever, incr_score, keep_in_progress,
603+
job_id,
604+
finish,
605+
result_data,
606+
result_timeout_s,
607+
keep_result_forever,
608+
incr_score,
609+
keep_in_progress,
604610
)
605611
)
606612

@@ -642,7 +648,9 @@ async def finish_failed_job(self, job_id: str, result_data: Optional[bytes]) ->
642648
await conn.unwatch()
643649
tr = conn.multi_exec()
644650
tr.delete(
645-
retry_key_prefix + job_id, in_progress_key_prefix + job_id, job_key_prefix + job_id,
651+
retry_key_prefix + job_id,
652+
in_progress_key_prefix + job_id,
653+
job_key_prefix + job_id,
646654
)
647655
tr.zrem(abort_jobs_ss, job_id)
648656
tr.zrem(self.queue_name, job_id)
@@ -798,5 +806,4 @@ def check_health(settings_cls: 'WorkerSettingsType') -> int:
798806
redis_settings = cast(Optional[RedisSettings], cls_kwargs.get('redis_settings'))
799807
health_check_key = cast(Optional[str], cls_kwargs.get('health_check_key'))
800808
queue_name = cast(Optional[str], cls_kwargs.get('queue_name'))
801-
loop = asyncio.get_event_loop()
802-
return loop.run_until_complete(async_check_health(redis_settings, health_check_key, queue_name))
809+
return asyncio.run(async_check_health(redis_settings, health_check_key, queue_name))

pyproject.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[tool.pytest.ini_options]
2+
testpaths = 'tests'
3+
filterwarnings = ['error', 'ignore::DeprecationWarning:aioredis']
4+
asyncio_mode = 'auto'
5+
timeout = 10
6+
7+
[tool.coverage.run]
8+
source = ['src']
9+
branch = true
10+
11+
[tool.coverage.report]
12+
precision = 2
13+
exclude_lines = [
14+
'pragma: no cover',
15+
'raise NotImplementedError',
16+
'raise NotImplemented',
17+
'if TYPE_CHECKING:',
18+
'@overload',
19+
]
20+
21+
[tool.black]
22+
color = true
23+
line-length = 120
24+
target-version = ['py39']
25+
skip-string-normalization = true
26+
27+
[tool.isort]
28+
line_length = 120
29+
known_third_party = 'foxglove'
30+
multi_line_output = 3
31+
include_trailing_comma = true
32+
force_grid_wrap = 0
33+
combine_as_imports = true
34+
color_output = true
35+
36+
[tool.mypy]
37+
follow_imports = 'silent'
38+
strict_optional = true
39+
warn_redundant_casts = true
40+
warn_unused_ignores = true
41+
disallow_any_generics = true
42+
check_untyped_defs = true
43+
no_implicit_reexport = true
44+
warn_unused_configs = true
45+
disallow_subclassing_any = true
46+
disallow_incomplete_defs = true
47+
disallow_untyped_decorators = true
48+
disallow_untyped_calls = true
49+
50+
# for strict mypy: (this is the tricky one :-))
51+
disallow_untyped_defs = true
52+
53+
# remaining arguments from `mypy --strict` which cause errors
54+
#no_implicit_optional = true
55+
#warn_return_any = true
56+
57+
[[tool.mypy.overrides]]
58+
module = ['aioredis', 'watchgod']
59+
ignore_missing_imports = true

setup.cfg

Lines changed: 0 additions & 59 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
'Programming Language :: Python',
3232
'Programming Language :: Python :: 3',
3333
'Programming Language :: Python :: 3 :: Only',
34-
'Programming Language :: Python :: 3.6',
3534
'Programming Language :: Python :: 3.7',
3635
'Programming Language :: Python :: 3.8',
3736
'Programming Language :: Python :: 3.9',

0 commit comments

Comments
 (0)