Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use importlib mode for pytest #1046

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/changed/importlib_mode_pytest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Tests now use [`--import-mode=importlib`](https://docs.pytest.org/en/stable/explanation/goodpractices.html#which-import-mode).
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ use_parentheses = true
line_length = 80

[tool.pytest.ini_options]
addopts = "--doctest-modules"
addopts = "--doctest-modules --import-mode=importlib"

[tool.mypy]
files = [
Expand Down
3 changes: 2 additions & 1 deletion tests/test_global_licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pathlib import Path

import pytest
from conftest import RESOURCES_DIRECTORY, posix
from debian.copyright import Copyright
from license_expression import LicenseSymbol

Expand All @@ -26,6 +25,8 @@
ReuseTOML,
)

from .conftest import RESOURCES_DIRECTORY, posix

# REUSE-IgnoreStart

# pylint: disable=redefined-outer-name,too-many-lines
Expand Down
4 changes: 2 additions & 2 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import re
import shutil

from conftest import cpython, posix

from reuse.lint import format_lines, format_plain
from reuse.project import Project
from reuse.report import ProjectReport

from .conftest import cpython, posix

# REUSE-IgnoreStart


Expand Down
3 changes: 2 additions & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
from urllib.error import URLError

import pytest
from conftest import RESOURCES_DIRECTORY
from freezegun import freeze_time

from reuse import download
from reuse._main import main
from reuse._util import GIT_EXE, HG_EXE, PIJUL_EXE, cleandoc_nl
from reuse.report import LINT_VERSION

from .conftest import RESOURCES_DIRECTORY

# REUSE-IgnoreStart


Expand Down
3 changes: 2 additions & 1 deletion tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pathlib import Path

import pytest
from conftest import RESOURCES_DIRECTORY, posix
from license_expression import LicenseSymbol

from reuse import ReuseInfo, SourceType
Expand All @@ -26,6 +25,8 @@
)
from reuse.project import GlobalLicensingConflict, Project

from .conftest import RESOURCES_DIRECTORY, posix

# REUSE-IgnoreStart


Expand Down
4 changes: 2 additions & 2 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
from inspect import cleandoc
from textwrap import dedent

from conftest import cpython, posix

from reuse import SourceType
from reuse.project import Project
from reuse.report import FileReport, ProjectReport

from .conftest import cpython, posix

# REUSE-IgnoreStart


Expand Down
3 changes: 2 additions & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

import pytest
from boolean.boolean import ParseError
from conftest import no_root, posix

from reuse import _util
from reuse._util import _LICENSING

from .conftest import no_root, posix

# REUSE-IgnoreStart


Expand Down
Loading