Skip to content

Commit db0fe7b

Browse files
Apply suggestions from code review
Co-authored-by: Ran Benita <[email protected]>
1 parent a0a6b84 commit db0fe7b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pytest_django/runner.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,36 @@
22
from typing import Any, Iterable
33

44

5-
class PytestTestRunner:
6-
"""Runs pytest to discover and run tests."""
5+
class TestRunner:
6+
"""A Django test runner which uses pytest to discover and run tests when using `manage.py test`."""
77

88
def __init__(
9-
self, verbosity: int = 1, failfast: bool = False, keepdb: bool = False, **kwargs: Any
9+
self,
10+
*,
11+
verbosity: int = 1,
12+
failfast: bool = False,
13+
keepdb: bool = False,
14+
**kwargs: Any,
1015
) -> None:
1116
self.verbosity = verbosity
1217
self.failfast = failfast
1318
self.keepdb = keepdb
1419

1520
@classmethod
1621
def add_arguments(cls, parser: ArgumentParser) -> None:
22+
parser.add_argument(
23+
"--failfast",
24+
action="store_true",
25+
help="Stops the test suite after the first failure.",
26+
)
1727
parser.add_argument(
1828
"--keepdb", action="store_true", help="Preserves the test DB between runs."
1929
)
2030

2131
def run_tests(self, test_labels: Iterable[str], **kwargs: Any) -> int:
2232
"""Run pytest and return the exitcode.
2333
24-
It translates some of Django"s test command option to pytest"s.
34+
It translates some of Django's test command option to pytest's.
2535
"""
2636
import pytest
2737

0 commit comments

Comments
 (0)