Skip to content

Commit 27d2683

Browse files
authored
Merge pull request #4134 from blueyed/minor
Minor: code style / constant
2 parents 792f365 + ee54fb9 commit 27d2683

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/_pytest/fixtures.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ class FixtureFunctionMarker(object):
10131013

10141014
def __call__(self, function):
10151015
if isclass(function):
1016-
raise ValueError("class fixtures not supported (may be in the future)")
1016+
raise ValueError("class fixtures not supported (maybe in the future)")
10171017

10181018
if getattr(function, "_pytestfixturefunction", False):
10191019
raise ValueError(
@@ -1366,8 +1366,7 @@ def getfixturedefs(self, argname, nodeid):
13661366
fixturedefs = self._arg2fixturedefs[argname]
13671367
except KeyError:
13681368
return None
1369-
else:
1370-
return tuple(self._matchfactories(fixturedefs, nodeid))
1369+
return tuple(self._matchfactories(fixturedefs, nodeid))
13711370

13721371
def _matchfactories(self, fixturedefs, nodeid):
13731372
for fixturedef in fixturedefs:

src/_pytest/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,7 @@ def _recurse(self, path):
564564
return True
565565

566566
def _tryconvertpyarg(self, x):
567-
"""Convert a dotted module name to path.
568-
569-
"""
567+
"""Convert a dotted module name to path."""
570568
try:
571569
with _patched_find_module():
572570
loader = pkgutil.find_loader(x)
@@ -598,8 +596,7 @@ def _parsearg(self, arg):
598596
raise UsageError(
599597
"file or package not found: " + arg + " (missing __init__.py?)"
600598
)
601-
else:
602-
raise UsageError("file not found: " + arg)
599+
raise UsageError("file not found: " + arg)
603600
parts[0] = path
604601
return parts
605602

src/_pytest/pytester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from _pytest._code import Source
2020
import py
2121
import pytest
22-
from _pytest.main import Session, EXIT_OK
22+
from _pytest.main import Session, EXIT_INTERRUPTED, EXIT_OK
2323
from _pytest.assertion.rewrite import AssertionRewritingHook
2424
from _pytest.compat import Path
2525
from _pytest.compat import safe_str
@@ -845,7 +845,7 @@ class reprec(object):
845845

846846
# typically we reraise keyboard interrupts from the child run
847847
# because it's our user requesting interruption of the testing
848-
if ret == 2 and not kwargs.get("no_reraise_ctrlc"):
848+
if ret == EXIT_INTERRUPTED and not kwargs.get("no_reraise_ctrlc"):
849849
calls = reprec.getcalls("pytest_keyboard_interrupt")
850850
if calls and calls[-1].excinfo.type == KeyboardInterrupt:
851851
raise KeyboardInterrupt()

0 commit comments

Comments
 (0)