Skip to content

Commit e1e2116

Browse files
committed
Fix linter
1 parent 54a15e8 commit e1e2116

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pytest_django/runner.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1+
from typing import TYPE_CHECKING
2+
3+
4+
if TYPE_CHECKING:
5+
from argparse import ArgumentParser
6+
from typing import Any
7+
8+
19
class PytestTestRunner:
210
"""Runs pytest to discover and run tests."""
311

4-
def __init__(self, verbosity=1, failfast=False, keepdb=False, **kwargs):
12+
def __init__(
13+
self, verbosity: int = 1, failfast: bool = False, keepdb: bool = False, **kwargs: Any
14+
) -> None:
515
self.verbosity = verbosity
616
self.failfast = failfast
717
self.keepdb = keepdb
818

919
@classmethod
10-
def add_arguments(cls, parser):
20+
def add_arguments(cls, parser: ArgumentParser) -> None:
1121
parser.add_argument(
1222
"--keepdb", action="store_true", help="Preserves the test DB between runs."
1323
)
1424

15-
def run_tests(self, test_labels, **kwargs):
25+
def run_tests(self, *test_labels: str, **kwargs: Any) -> int:
1626
"""Run pytest and return the exitcode.
1727
1828
It translates some of Django"s test command option to pytest"s.

tests/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ def test_runner_run_tests(monkeypatch, kwargs, expected):
2424
pytest_mock = Mock()
2525
monkeypatch.setattr("pytest.main", pytest_mock)
2626
runner = PytestTestRunner(**kwargs)
27-
runner.run_tests(["tests"])
27+
runner.run_tests("tests")
2828
assert pytest_mock.call_args == expected

0 commit comments

Comments
 (0)