Skip to content

Commit 1bc7b06

Browse files
fix(deps): update dependency flake8 to v5 (#559)
* refactor: check exit code instead of SystemExit Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: W. Augusto Andreoli <andreoliwa@gmail.com>
1 parent 1e58ff2 commit 1bc7b06

File tree

2 files changed

+53
-46
lines changed

2 files changed

+53
-46
lines changed

‎poetry.lock

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

‎tests/test_plugin.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33
from enum import Enum
44

5-
import pytest
65
import responses
76
from flake8.main import cli
87

@@ -17,13 +16,22 @@
1716
def _call_main(argv, retv=0):
1817
"""Call flake8's main CLI entry point.
1918
20-
This is how flake8 itself runs CLI tests.
19+
This is how flake8 itself used to run CLI tests.
2120
Copied from:
22-
https://github.com/PyCQA/flake8/blob/master/tests/integration/test_main.py#L12-15
21+
https://github.com/PyCQA/flake8/blame/5a85dd8ddb2dbd3027415594160c40e63b9b44e5/tests/integration/test_main.py#L13-L16
2322
"""
24-
with pytest.raises(SystemExit) as excinfo:
25-
cli.main(argv)
26-
assert excinfo.value.code == retv
23+
# Since 5.0.0, flake8 is returning an exit code instead of raising SystemExit
24+
# https://github.com/PyCQA/flake8/commit/81a4110338496714c0bf2bb0e8dd929461d9d492
25+
26+
# This change only affects nitpick's tests, not its code.
27+
# No need to pin flake8 on pyproject.toml;
28+
# nitpick uses a recent flake8 on poetry.lock
29+
# but won't enforce the new version
30+
# and will still work if the developer has an older flake8 version
31+
32+
# This is how flake8 tests the exit code nowadays:
33+
# https://github.com/PyCQA/flake8/blob/45699b61ae4522864c60480c80d7c2ffb952d52e/tests/integration/test_main.py#L28
34+
assert cli.main(argv) == retv
2735

2836

2937
def test_absent_files(tmp_path):

0 commit comments

Comments
 (0)