Merge pull request #4134 from blueyed/minor
Minor: code style / constant
This commit is contained in:
commit
27d2683a02
|
@ -1013,7 +1013,7 @@ class FixtureFunctionMarker(object):
|
||||||
|
|
||||||
def __call__(self, function):
|
def __call__(self, function):
|
||||||
if isclass(function):
|
if isclass(function):
|
||||||
raise ValueError("class fixtures not supported (may be in the future)")
|
raise ValueError("class fixtures not supported (maybe in the future)")
|
||||||
|
|
||||||
if getattr(function, "_pytestfixturefunction", False):
|
if getattr(function, "_pytestfixturefunction", False):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
@ -1366,7 +1366,6 @@ class FixtureManager(object):
|
||||||
fixturedefs = self._arg2fixturedefs[argname]
|
fixturedefs = self._arg2fixturedefs[argname]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return None
|
return None
|
||||||
else:
|
|
||||||
return tuple(self._matchfactories(fixturedefs, nodeid))
|
return tuple(self._matchfactories(fixturedefs, nodeid))
|
||||||
|
|
||||||
def _matchfactories(self, fixturedefs, nodeid):
|
def _matchfactories(self, fixturedefs, nodeid):
|
||||||
|
|
|
@ -564,9 +564,7 @@ class Session(nodes.FSCollector):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _tryconvertpyarg(self, x):
|
def _tryconvertpyarg(self, x):
|
||||||
"""Convert a dotted module name to path.
|
"""Convert a dotted module name to path."""
|
||||||
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
with _patched_find_module():
|
with _patched_find_module():
|
||||||
loader = pkgutil.find_loader(x)
|
loader = pkgutil.find_loader(x)
|
||||||
|
@ -598,7 +596,6 @@ class Session(nodes.FSCollector):
|
||||||
raise UsageError(
|
raise UsageError(
|
||||||
"file or package not found: " + arg + " (missing __init__.py?)"
|
"file or package not found: " + arg + " (missing __init__.py?)"
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
raise UsageError("file not found: " + arg)
|
raise UsageError("file not found: " + arg)
|
||||||
parts[0] = path
|
parts[0] = path
|
||||||
return parts
|
return parts
|
||||||
|
|
|
@ -19,7 +19,7 @@ from _pytest.capture import MultiCapture, SysCapture
|
||||||
from _pytest._code import Source
|
from _pytest._code import Source
|
||||||
import py
|
import py
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.main import Session, EXIT_OK
|
from _pytest.main import Session, EXIT_INTERRUPTED, EXIT_OK
|
||||||
from _pytest.assertion.rewrite import AssertionRewritingHook
|
from _pytest.assertion.rewrite import AssertionRewritingHook
|
||||||
from _pytest.compat import Path
|
from _pytest.compat import Path
|
||||||
from _pytest.compat import safe_str
|
from _pytest.compat import safe_str
|
||||||
|
@ -845,7 +845,7 @@ class Testdir(object):
|
||||||
|
|
||||||
# typically we reraise keyboard interrupts from the child run
|
# typically we reraise keyboard interrupts from the child run
|
||||||
# because it's our user requesting interruption of the testing
|
# because it's our user requesting interruption of the testing
|
||||||
if ret == 2 and not kwargs.get("no_reraise_ctrlc"):
|
if ret == EXIT_INTERRUPTED and not kwargs.get("no_reraise_ctrlc"):
|
||||||
calls = reprec.getcalls("pytest_keyboard_interrupt")
|
calls = reprec.getcalls("pytest_keyboard_interrupt")
|
||||||
if calls and calls[-1].excinfo.type == KeyboardInterrupt:
|
if calls and calls[-1].excinfo.type == KeyboardInterrupt:
|
||||||
raise KeyboardInterrupt()
|
raise KeyboardInterrupt()
|
||||||
|
|
Loading…
Reference in New Issue