Skip to content

Commit b7fcb67

Browse files
fix(deps): update dependency sphinx to v5 (#560)
* test: deal with different versions of flake8 * build: pin importlib-metadata to avoid AttributeError Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: W. Augusto Andreoli <andreoliwa@gmail.com>
1 parent 6a4fddd commit b7fcb67

3 files changed

Lines changed: 63 additions & 53 deletions

File tree

poetry.lock

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

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ flatten-dict = "*"
8181
dpath = "*"
8282
furl = "*"
8383
StrEnum = "*"
84+
# To avoid this error on python3.7: AttributeError: 'EntryPoints' object has no attribute 'get'
85+
# https://importlib-metadata.readthedocs.io/en/latest/history.html#v5-0-0
86+
importlib-metadata = {version = "<5.0", python = "<3.8"}
8487

8588
# TODO: chore: move to dependency groups once the feature is on a stable version of Poetry
8689
# https://python-poetry.org/docs/master/managing-dependencies/#dependency-groups

tests/test_plugin.py

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

5+
import flake8
6+
import pytest
57
import responses
68
from flake8.main import cli
79

@@ -20,18 +22,22 @@ def _call_main(argv, retv=0):
2022
Copied from:
2123
https://github.com/PyCQA/flake8/blame/5a85dd8ddb2dbd3027415594160c40e63b9b44e5/tests/integration/test_main.py#L13-L16
2224
"""
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
25+
if flake8.__version_info__ < (5, 0, 0):
26+
# Since 5.0.0, flake8 is returning an exit code instead of raising SystemExit
27+
# https://github.com/PyCQA/flake8/commit/81a4110338496714c0bf2bb0e8dd929461d9d492
28+
29+
# This change only affects nitpick's tests, not its code.
30+
# No need to pin flake8 on pyproject.toml;
31+
# nitpick uses a recent flake8 on poetry.lock
32+
# but won't enforce the new version
33+
# and will still work if the developer has an older flake8 version
34+
with pytest.raises(SystemExit) as excinfo:
35+
cli.main(argv)
36+
assert excinfo.value.code == retv
37+
else:
38+
# This is how flake8 tests the exit code nowadays:
39+
# https://github.com/PyCQA/flake8/blob/45699b61ae4522864c60480c80d7c2ffb952d52e/tests/integration/test_main.py#L28
40+
assert cli.main(argv) == retv
3541

3642

3743
def test_absent_files(tmp_path):

0 commit comments

Comments
 (0)