Skip to content

Commit

Permalink
fix(deps): update dependency sphinx to v5 (#560)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
renovate[bot] and andreoliwa committed Mar 27, 2023
1 parent 6a4fddd commit b7fcb67
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 53 deletions.
83 changes: 42 additions & 41 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ flatten-dict = "*"
dpath = "*"
furl = "*"
StrEnum = "*"
# To avoid this error on python3.7: AttributeError: 'EntryPoints' object has no attribute 'get'
# https://importlib-metadata.readthedocs.io/en/latest/history.html#v5-0-0
importlib-metadata = {version = "<5.0", python = "<3.8"}

# TODO: chore: move to dependency groups once the feature is on a stable version of Poetry
# https://python-poetry.org/docs/master/managing-dependencies/#dependency-groups
Expand Down
30 changes: 18 additions & 12 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
from enum import Enum

import flake8
import pytest
import responses
from flake8.main import cli

Expand All @@ -20,18 +22,22 @@ def _call_main(argv, retv=0):
Copied from:
https://github.com/PyCQA/flake8/blame/5a85dd8ddb2dbd3027415594160c40e63b9b44e5/tests/integration/test_main.py#L13-L16
"""
# Since 5.0.0, flake8 is returning an exit code instead of raising SystemExit
# https://github.com/PyCQA/flake8/commit/81a4110338496714c0bf2bb0e8dd929461d9d492

# This change only affects nitpick's tests, not its code.
# No need to pin flake8 on pyproject.toml;
# nitpick uses a recent flake8 on poetry.lock
# but won't enforce the new version
# and will still work if the developer has an older flake8 version

# This is how flake8 tests the exit code nowadays:
# https://github.com/PyCQA/flake8/blob/45699b61ae4522864c60480c80d7c2ffb952d52e/tests/integration/test_main.py#L28
assert cli.main(argv) == retv
if flake8.__version_info__ < (5, 0, 0):
# Since 5.0.0, flake8 is returning an exit code instead of raising SystemExit
# https://github.com/PyCQA/flake8/commit/81a4110338496714c0bf2bb0e8dd929461d9d492

# This change only affects nitpick's tests, not its code.
# No need to pin flake8 on pyproject.toml;
# nitpick uses a recent flake8 on poetry.lock
# but won't enforce the new version
# and will still work if the developer has an older flake8 version
with pytest.raises(SystemExit) as excinfo:
cli.main(argv)
assert excinfo.value.code == retv
else:
# This is how flake8 tests the exit code nowadays:
# https://github.com/PyCQA/flake8/blob/45699b61ae4522864c60480c80d7c2ffb952d52e/tests/integration/test_main.py#L28
assert cli.main(argv) == retv


def test_absent_files(tmp_path):
Expand Down

0 comments on commit b7fcb67

Please sign in to comment.