File tree Expand file tree Collapse file tree 2 files changed +53
-46
lines changed Expand file tree Collapse file tree 2 files changed +53
-46
lines changed Original file line number Diff line number Diff line change 2
2
import os
3
3
from enum import Enum
4
4
5
- import pytest
6
5
import responses
7
6
from flake8 .main import cli
8
7
17
16
def _call_main (argv , retv = 0 ):
18
17
"""Call flake8's main CLI entry point.
19
18
20
- This is how flake8 itself runs CLI tests.
19
+ This is how flake8 itself used to run CLI tests.
21
20
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
23
22
"""
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
27
35
28
36
29
37
def test_absent_files (tmp_path ):
You can’t perform that action at this time.
0 commit comments