diff options
| -rw-r--r-- | pyproject.toml | 1 | ||||
| -rw-r--r-- | tests/conftest.py | 4 | ||||
| -rw-r--r-- | tests/test_dl.py | 4 | ||||
| -rw-r--r-- | tests/test_file_class.py | 4 | ||||
| -rw-r--r-- | tests/test_logging.py | 4 | ||||
| -rw-r--r-- | tests/test_parse.py | 10 | ||||
| -rw-r--r-- | tests/test_validations.py | 2 |
7 files changed, 15 insertions, 14 deletions
diff --git a/pyproject.toml b/pyproject.toml index 9c88c2e..37735a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,6 +136,7 @@ select = [ "PLE", "PLR", "PLW", + "PT", "Q", "RUF", "S", diff --git a/tests/conftest.py b/tests/conftest.py index 94fc053..cda7dd3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,8 +19,8 @@ import pytest import requests_mock as rm -@pytest.fixture -def mock_get(requests_mock: rm.Mocker) -> None: +@pytest.fixture() +def _mock_get(requests_mock: rm.Mocker) -> None: # fake the download request for File:Example.jpg requests_mock.get( "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg", diff --git a/tests/test_dl.py b/tests/test_dl.py index d39c352..6075515 100644 --- a/tests/test_dl.py +++ b/tests/test_dl.py @@ -281,9 +281,9 @@ class TestBatchDownload: assert errors == 1 -@pytest.mark.usefixtures("mock_get") +@pytest.mark.usefixtures("_mock_get") class TestDownload: - @pytest.fixture + @pytest.fixture() def mock_file(self, tmp_path: Path) -> File: file = File(name="Example.jpg", dest=str(tmp_path / "Example.jpg")) file.image = Mock() diff --git a/tests/test_file_class.py b/tests/test_file_class.py index 42f5667..ee25f1c 100644 --- a/tests/test_file_class.py +++ b/tests/test_file_class.py @@ -22,7 +22,7 @@ from wikiget.file import File class TestFileClass: - @pytest.fixture + @pytest.fixture() def file_with_name(self) -> File: """ A File object created with only a name should set its destination property to @@ -39,7 +39,7 @@ class TestFileClass: def test_file_with_name_site(self, file_with_name: File) -> None: assert file_with_name.site == DEFAULT_SITE - @pytest.fixture + @pytest.fixture() def file_with_name_and_dest(self) -> File: """ A File object created with a name and destination should set those properties diff --git a/tests/test_logging.py b/tests/test_logging.py index 55a3397..5d3aa4c 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -18,7 +18,7 @@ import logging from pathlib import Path -from pytest import LogCaptureFixture +import pytest from wikiget.logging import FileLogAdapter, configure_logging from wikiget.wikiget import parse_args @@ -27,7 +27,7 @@ from wikiget.wikiget import parse_args class TestLogging: logger = logging.getLogger() - def test_custom_log_adapter(self, caplog: LogCaptureFixture) -> None: + def test_custom_log_adapter(self, caplog: pytest.LogCaptureFixture) -> None: """The custom log adapter should prepend the filename to log messages.""" args = parse_args(["File:Example.jpg"]) configure_logging(args.verbose, args.logfile, quiet=args.quiet) diff --git a/tests/test_parse.py b/tests/test_parse.py index e0ac707..d289d1d 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -29,7 +29,7 @@ from wikiget.wikiget import parse_args class TestGetDest: - @pytest.fixture + @pytest.fixture() def file_with_filename(self) -> File: """ When a filename is passed to get_dest, it should create a File object with the @@ -47,7 +47,7 @@ class TestGetDest: def test_get_dest_site_with_filename(self, file_with_filename: File) -> None: assert file_with_filename.site == "commons.wikimedia.org" - @pytest.fixture + @pytest.fixture() def file_with_url(self) -> File: """ When a URL is passed to get_dest, it should create a File object with the @@ -92,7 +92,7 @@ class TestGetDest: class TestReadBatchFile: - @pytest.fixture + @pytest.fixture() def dl_dict(self, tmp_path: Path) -> Dict[int, str]: """ Create and process a test batch file with three lines, returning a dictionary. @@ -129,7 +129,7 @@ class TestReadBatchFile: expected_list = {1: "File:Foo.jpg", 2: "File:Bar.jpg", 3: "File:Baz.jpg"} assert dl_dict == expected_list - @pytest.fixture + @pytest.fixture() def dl_dict_stdin(self, monkeypatch: pytest.MonkeyPatch) -> Dict[int, str]: """ Pass three lines of filenames from stdin to read_batch_file and return a dict. @@ -165,7 +165,7 @@ class TestReadBatchFile: expected_list = {1: "File:Foo.jpg", 2: "File:Bar.jpg", 3: "File:Baz.jpg"} assert dl_dict_stdin == expected_list - @pytest.fixture + @pytest.fixture() def dl_dict_with_comment(self, tmp_path: Path) -> Dict[int, str]: """ Create and process a test batch file with four lines, one of which is diff --git a/tests/test_validations.py b/tests/test_validations.py index b3976b6..a1c57b5 100644 --- a/tests/test_validations.py +++ b/tests/test_validations.py @@ -57,7 +57,7 @@ class TestSiteInput: class TestFileRegex: - @pytest.fixture + @pytest.fixture() def file_match(self) -> Optional[Match]: """ File regex should return a match object with match groups corresponding |
