parent
b840622819
commit
7248b759e8
|
@ -25,7 +25,6 @@ def pytest_addoption(parser):
|
||||||
expression information.""")
|
expression information.""")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def register_assert_rewrite(*names):
|
def register_assert_rewrite(*names):
|
||||||
"""Register one or more module names to be rewritten on import.
|
"""Register one or more module names to be rewritten on import.
|
||||||
|
|
||||||
|
|
|
@ -215,8 +215,6 @@ class AssertionRewritingHook(object):
|
||||||
raise
|
raise
|
||||||
return sys.modules[name]
|
return sys.modules[name]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def is_package(self, name):
|
def is_package(self, name):
|
||||||
try:
|
try:
|
||||||
fd, fn, desc = imp.find_module(name)
|
fd, fn, desc = imp.find_module(name)
|
||||||
|
@ -900,7 +898,6 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
else:
|
else:
|
||||||
visit_Call = visit_Call_legacy
|
visit_Call = visit_Call_legacy
|
||||||
|
|
||||||
|
|
||||||
def visit_Attribute(self, attr):
|
def visit_Attribute(self, attr):
|
||||||
if not isinstance(attr.ctx, ast.Load):
|
if not isinstance(attr.ctx, ast.Load):
|
||||||
return self.generic_visit(attr)
|
return self.generic_visit(attr)
|
||||||
|
|
|
@ -180,7 +180,6 @@ def pytest_cmdline_main(config):
|
||||||
return wrap_session(config, cacheshow)
|
return wrap_session(config, cacheshow)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.hookimpl(tryfirst=True)
|
@pytest.hookimpl(tryfirst=True)
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.cache = Cache(config)
|
config.cache = Cache(config)
|
||||||
|
|
|
@ -13,7 +13,6 @@ import py
|
||||||
import _pytest
|
import _pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import enum
|
import enum
|
||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
|
@ -111,7 +110,6 @@ def getfuncargnames(function, startindex=None):
|
||||||
return tuple(argnames[startindex:])
|
return tuple(argnames[startindex:])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[:2] == (2, 6):
|
if sys.version_info[:2] == (2, 6):
|
||||||
def isclass(object):
|
def isclass(object):
|
||||||
""" Return true if the object is a class. Overrides inspect.isclass for
|
""" Return true if the object is a class. Overrides inspect.isclass for
|
||||||
|
|
|
@ -851,7 +851,6 @@ class DropShorterLongHelpFormatter(argparse.HelpFormatter):
|
||||||
return action._formatted_action_invocation
|
return action._formatted_action_invocation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _ensure_removed_sysmodule(modname):
|
def _ensure_removed_sysmodule(modname):
|
||||||
try:
|
try:
|
||||||
del sys.modules[modname]
|
del sys.modules[modname]
|
||||||
|
|
|
@ -4,7 +4,6 @@ import pdb
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
group = parser.getgroup("general")
|
group = parser.getgroup("general")
|
||||||
group._addoption(
|
group._addoption(
|
||||||
|
|
|
@ -116,7 +116,6 @@ def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager):
|
||||||
node._name2pseudofixturedef[argname] = fixturedef
|
node._name2pseudofixturedef[argname] = fixturedef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getfixturemarker(obj):
|
def getfixturemarker(obj):
|
||||||
""" return fixturemarker or None if it doesn't exist or raised
|
""" return fixturemarker or None if it doesn't exist or raised
|
||||||
exceptions."""
|
exceptions."""
|
||||||
|
@ -128,7 +127,6 @@ def getfixturemarker(obj):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_parametrized_fixture_keys(item, scopenum):
|
def get_parametrized_fixture_keys(item, scopenum):
|
||||||
""" return list of keys for all parametrized arguments which match
|
""" return list of keys for all parametrized arguments which match
|
||||||
the specified scope. """
|
the specified scope. """
|
||||||
|
@ -240,7 +238,6 @@ def fillfixtures(function):
|
||||||
request._fillfixtures()
|
request._fillfixtures()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_direct_param_fixture_func(request):
|
def get_direct_param_fixture_func(request):
|
||||||
return request.param
|
return request.param
|
||||||
|
|
||||||
|
@ -283,7 +280,6 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||||
""" underlying collection node (depends on current request scope)"""
|
""" underlying collection node (depends on current request scope)"""
|
||||||
return self._getscopeitem(self.scope)
|
return self._getscopeitem(self.scope)
|
||||||
|
|
||||||
|
|
||||||
def _getnextfixturedef(self, argname):
|
def _getnextfixturedef(self, argname):
|
||||||
fixturedefs = self._arg2fixturedefs.get(argname, None)
|
fixturedefs = self._arg2fixturedefs.get(argname, None)
|
||||||
if fixturedefs is None:
|
if fixturedefs is None:
|
||||||
|
@ -305,7 +301,6 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||||
""" the pytest config object associated with this request. """
|
""" the pytest config object associated with this request. """
|
||||||
return self._pyfuncitem.config
|
return self._pyfuncitem.config
|
||||||
|
|
||||||
|
|
||||||
@scopeproperty()
|
@scopeproperty()
|
||||||
def function(self):
|
def function(self):
|
||||||
""" test function object if the request has a per-function scope. """
|
""" test function object if the request has a per-function scope. """
|
||||||
|
@ -839,7 +834,6 @@ class FixtureFunctionMarker:
|
||||||
return function
|
return function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def fixture(scope="function", params=None, autouse=False, ids=None, name=None):
|
def fixture(scope="function", params=None, autouse=False, ids=None, name=None):
|
||||||
""" (return a) decorator to mark a fixture factory function.
|
""" (return a) decorator to mark a fixture factory function.
|
||||||
|
|
||||||
|
@ -955,7 +949,6 @@ class FixtureManager:
|
||||||
self._nodeid_and_autousenames = [("", self.config.getini("usefixtures"))]
|
self._nodeid_and_autousenames = [("", self.config.getini("usefixtures"))]
|
||||||
session.config.pluginmanager.register(self, "funcmanage")
|
session.config.pluginmanager.register(self, "funcmanage")
|
||||||
|
|
||||||
|
|
||||||
def getfixtureinfo(self, node, func, cls, funcargs=True):
|
def getfixtureinfo(self, node, func, cls, funcargs=True):
|
||||||
if funcargs and not hasattr(node, "nofuncargs"):
|
if funcargs and not hasattr(node, "nofuncargs"):
|
||||||
if cls is not None:
|
if cls is not None:
|
||||||
|
|
|
@ -5,7 +5,6 @@ pytest
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def freeze_includes():
|
def freeze_includes():
|
||||||
"""
|
"""
|
||||||
Returns a list of module names used by py.test that should be
|
Returns a list of module names used by py.test that should be
|
||||||
|
|
|
@ -77,7 +77,6 @@ def pytest_addoption(parser):
|
||||||
help="base temporary directory for this test run.")
|
help="base temporary directory for this test run.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_namespace():
|
def pytest_namespace():
|
||||||
"""keeping this one works around a deeper startup issue in pytest
|
"""keeping this one works around a deeper startup issue in pytest
|
||||||
|
|
||||||
|
@ -217,7 +216,6 @@ class _CompatProperty(object):
|
||||||
return getattr(__import__('pytest'), self.name)
|
return getattr(__import__('pytest'), self.name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class NodeKeywords(MappingMixin):
|
class NodeKeywords(MappingMixin):
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
|
|
|
@ -245,7 +245,6 @@ class MarkGenerator:
|
||||||
on the ``test_function`` object. """
|
on the ``test_function`` object. """
|
||||||
_config = None
|
_config = None
|
||||||
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name[0] == "_":
|
if name[0] == "_":
|
||||||
raise AttributeError("Marker name must NOT start with underscore")
|
raise AttributeError("Marker name must NOT start with underscore")
|
||||||
|
@ -356,9 +355,6 @@ class MarkDecorator:
|
||||||
return self.__class__(self.mark.combined_with(mark))
|
return self.__class__(self.mark.combined_with(mark))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Mark(namedtuple('Mark', 'name, args, kwargs')):
|
class Mark(namedtuple('Mark', 'name, args, kwargs')):
|
||||||
|
|
||||||
def combined_with(self, other):
|
def combined_with(self, other):
|
||||||
|
|
|
@ -390,7 +390,6 @@ class RunResult:
|
||||||
assert failed == d.get("failed", 0)
|
assert failed == d.get("failed", 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Testdir:
|
class Testdir:
|
||||||
"""Temporary test directory with tools to test/run pytest itself.
|
"""Temporary test directory with tools to test/run pytest itself.
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ def filter_traceback(entry):
|
||||||
return p != cutdir1 and not p.relto(cutdir2) and not p.relto(cutdir3)
|
return p != cutdir1 and not p.relto(cutdir2) and not p.relto(cutdir3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pyobj_property(name):
|
def pyobj_property(name):
|
||||||
def get(self):
|
def get(self):
|
||||||
node = self.getparent(getattr(__import__('pytest'), name))
|
node = self.getparent(getattr(__import__('pytest'), name))
|
||||||
|
@ -193,7 +192,6 @@ def pytest_make_parametrize_id(config, val, argname=None):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PyobjContext(object):
|
class PyobjContext(object):
|
||||||
module = pyobj_property("Module")
|
module = pyobj_property("Module")
|
||||||
cls = pyobj_property("Class")
|
cls = pyobj_property("Class")
|
||||||
|
|
|
@ -509,7 +509,6 @@ class TerminalReporter:
|
||||||
content = content[:-1]
|
content = content[:-1]
|
||||||
self._tw.line(content)
|
self._tw.line(content)
|
||||||
|
|
||||||
|
|
||||||
def summary_failures(self):
|
def summary_failures(self):
|
||||||
if self.config.option.tbstyle != "no":
|
if self.config.option.tbstyle != "no":
|
||||||
reports = self.getreports('failed')
|
reports = self.getreports('failed')
|
||||||
|
|
|
@ -81,7 +81,6 @@ class TestGeneralUsage(object):
|
||||||
"*---unconfigure",
|
"*---unconfigure",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_config_preparse_plugin_option(self, testdir):
|
def test_config_preparse_plugin_option(self, testdir):
|
||||||
testdir.makepyfile(pytest_xyz="""
|
testdir.makepyfile(pytest_xyz="""
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
@ -147,7 +146,6 @@ class TestGeneralUsage(object):
|
||||||
*ERROR*could not load*conftest.py*
|
*ERROR*could not load*conftest.py*
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
def test_early_skip(self, testdir):
|
def test_early_skip(self, testdir):
|
||||||
testdir.mkdir("xyz")
|
testdir.mkdir("xyz")
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
|
@ -676,7 +674,6 @@ class TestInvocationVariants(object):
|
||||||
import _pytest.config
|
import _pytest.config
|
||||||
assert type(_pytest.config.get_plugin_manager()) is _pytest.config.PytestPluginManager
|
assert type(_pytest.config.get_plugin_manager()) is _pytest.config.PytestPluginManager
|
||||||
|
|
||||||
|
|
||||||
def test_has_plugin(self, request):
|
def test_has_plugin(self, request):
|
||||||
"""Test hasplugin function of the plugin manager (#932)."""
|
"""Test hasplugin function of the plugin manager (#932)."""
|
||||||
assert request.config.pluginmanager.hasplugin('python')
|
assert request.config.pluginmanager.hasplugin('python')
|
||||||
|
|
|
@ -467,7 +467,6 @@ class TestFormattedExcinfo(object):
|
||||||
'E AssertionError'
|
'E AssertionError'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_repr_source_not_existing(self):
|
def test_repr_source_not_existing(self):
|
||||||
pr = FormattedExcinfo()
|
pr = FormattedExcinfo()
|
||||||
co = compile("raise ValueError()", "", "exec")
|
co = compile("raise ValueError()", "", "exec")
|
||||||
|
@ -553,14 +552,12 @@ raise ValueError()
|
||||||
if py.std.sys.version_info[0] >= 3:
|
if py.std.sys.version_info[0] >= 3:
|
||||||
assert repr.chain[0][0].reprentries[0].lines[0] == "> ???"
|
assert repr.chain[0][0].reprentries[0].lines[0] == "> ???"
|
||||||
|
|
||||||
|
|
||||||
fail = py.error.ENOENT # noqa
|
fail = py.error.ENOENT # noqa
|
||||||
repr = pr.repr_excinfo(excinfo)
|
repr = pr.repr_excinfo(excinfo)
|
||||||
assert repr.reprtraceback.reprentries[0].lines[0] == "> ???"
|
assert repr.reprtraceback.reprentries[0].lines[0] == "> ???"
|
||||||
if py.std.sys.version_info[0] >= 3:
|
if py.std.sys.version_info[0] >= 3:
|
||||||
assert repr.chain[0][0].reprentries[0].lines[0] == "> ???"
|
assert repr.chain[0][0].reprentries[0].lines[0] == "> ???"
|
||||||
|
|
||||||
|
|
||||||
def test_repr_local(self):
|
def test_repr_local(self):
|
||||||
p = FormattedExcinfo(showlocals=True)
|
p = FormattedExcinfo(showlocals=True)
|
||||||
loc = {'y': 5, 'z': 7, 'x': 3, '@x': 2, '__builtins__': {}}
|
loc = {'y': 5, 'z': 7, 'x': 3, '@x': 2, '__builtins__': {}}
|
||||||
|
|
|
@ -642,7 +642,6 @@ finally:
|
||||||
assert str(source) == " raise IndexError(1)"
|
assert str(source) == " raise IndexError(1)"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestIf(object):
|
class TestIf(object):
|
||||||
pytestmark = astonly
|
pytestmark = astonly
|
||||||
source = """\
|
source = """\
|
||||||
|
|
|
@ -476,7 +476,6 @@ class TestFunction(object):
|
||||||
rec = testdir.inline_run()
|
rec = testdir.inline_run()
|
||||||
rec.assertoutcome(passed=2)
|
rec.assertoutcome(passed=2)
|
||||||
|
|
||||||
|
|
||||||
def test_parametrize_with_non_hashable_values_indirect(self, testdir):
|
def test_parametrize_with_non_hashable_values_indirect(self, testdir):
|
||||||
"""Test parametrization with non-hashable values with indirect parametrization."""
|
"""Test parametrization with non-hashable values with indirect parametrization."""
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
@ -504,7 +503,6 @@ class TestFunction(object):
|
||||||
rec = testdir.inline_run()
|
rec = testdir.inline_run()
|
||||||
rec.assertoutcome(passed=2)
|
rec.assertoutcome(passed=2)
|
||||||
|
|
||||||
|
|
||||||
def test_parametrize_overrides_fixture(self, testdir):
|
def test_parametrize_overrides_fixture(self, testdir):
|
||||||
"""Test parametrization when parameter overrides existing fixture with same name."""
|
"""Test parametrization when parameter overrides existing fixture with same name."""
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
@ -532,7 +530,6 @@ class TestFunction(object):
|
||||||
rec = testdir.inline_run()
|
rec = testdir.inline_run()
|
||||||
rec.assertoutcome(passed=3)
|
rec.assertoutcome(passed=3)
|
||||||
|
|
||||||
|
|
||||||
def test_parametrize_overrides_parametrized_fixture(self, testdir):
|
def test_parametrize_overrides_parametrized_fixture(self, testdir):
|
||||||
"""Test parametrization when parameter overrides existing parametrized fixture with same name."""
|
"""Test parametrization when parameter overrides existing parametrized fixture with same name."""
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
@ -1352,7 +1349,6 @@ def test_skip_duplicates_by_default(testdir):
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_keep_duplicates(testdir):
|
def test_keep_duplicates(testdir):
|
||||||
"""Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609)
|
"""Test for issue https://github.com/pytest-dev/pytest/issues/1609 (#1609)
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,6 @@ class TestFillFixtures(object):
|
||||||
])
|
])
|
||||||
assert "INTERNAL" not in result.stdout.str()
|
assert "INTERNAL" not in result.stdout.str()
|
||||||
|
|
||||||
|
|
||||||
def test_fixture_excinfo_leak(self, testdir):
|
def test_fixture_excinfo_leak(self, testdir):
|
||||||
# on python2 sys.excinfo would leak into fixture executions
|
# on python2 sys.excinfo would leak into fixture executions
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
@ -641,7 +640,6 @@ class TestRequestBasic(object):
|
||||||
mod = reprec.getcalls("pytest_runtest_setup")[0].item.module
|
mod = reprec.getcalls("pytest_runtest_setup")[0].item.module
|
||||||
assert not mod.l
|
assert not mod.l
|
||||||
|
|
||||||
|
|
||||||
def test_request_addfinalizer_partial_setup_failure(self, testdir):
|
def test_request_addfinalizer_partial_setup_failure(self, testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1603,8 +1601,6 @@ class TestAutouseManagement(object):
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run()
|
||||||
reprec.assertoutcome(passed=2)
|
reprec.assertoutcome(passed=2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_funcarg_and_setup(self, testdir):
|
def test_funcarg_and_setup(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -2406,7 +2402,6 @@ class TestFixtureMarker(object):
|
||||||
reprec = testdir.inline_run("-v")
|
reprec = testdir.inline_run("-v")
|
||||||
reprec.assertoutcome(passed=5)
|
reprec.assertoutcome(passed=5)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.issue246
|
@pytest.mark.issue246
|
||||||
@pytest.mark.parametrize("scope", ["session", "function", "module"])
|
@pytest.mark.parametrize("scope", ["session", "function", "module"])
|
||||||
def test_finalizer_order_on_parametrization(self, scope, testdir):
|
def test_finalizer_order_on_parametrization(self, scope, testdir):
|
||||||
|
@ -2638,8 +2633,6 @@ class TestErrors(object):
|
||||||
*3 pass*2 error*
|
*3 pass*2 error*
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_setupfunc_missing_funcarg(self, testdir):
|
def test_setupfunc_missing_funcarg(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -2747,7 +2740,6 @@ class TestShowFixtures(object):
|
||||||
|
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
def test_show_fixtures_different_files(self, testdir):
|
def test_show_fixtures_different_files(self, testdir):
|
||||||
"""
|
"""
|
||||||
#833: --fixtures only shows fixtures from first file
|
#833: --fixtures only shows fixtures from first file
|
||||||
|
|
|
@ -331,7 +331,6 @@ class TestMetafunc(object):
|
||||||
"\nUpdate your code as this will raise an error in pytest-4.0.",
|
"\nUpdate your code as this will raise an error in pytest-4.0.",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_parametrize_ids_exception(self, testdir):
|
def test_parametrize_ids_exception(self, testdir):
|
||||||
"""
|
"""
|
||||||
:param testdir: the instance of Testdir class, a temporary
|
:param testdir: the instance of Testdir class, a temporary
|
||||||
|
@ -776,7 +775,6 @@ class TestMetafuncFunctional(object):
|
||||||
result = testdir.runpytest(p)
|
result = testdir.runpytest(p)
|
||||||
result.assert_outcomes(passed=1)
|
result.assert_outcomes(passed=1)
|
||||||
|
|
||||||
|
|
||||||
def test_generate_plugin_and_module(self, testdir):
|
def test_generate_plugin_and_module(self, testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_generate_tests(metafunc):
|
def pytest_generate_tests(metafunc):
|
||||||
|
@ -1435,7 +1433,6 @@ class TestMarkersWithParametrization(object):
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run()
|
||||||
reprec.assertoutcome(passed=2, skipped=2)
|
reprec.assertoutcome(passed=2, skipped=2)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.issue290
|
@pytest.mark.issue290
|
||||||
def test_parametrize_ID_generation_string_int_works(self, testdir):
|
def test_parametrize_ID_generation_string_int_works(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
@ -1452,7 +1449,6 @@ class TestMarkersWithParametrization(object):
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run()
|
||||||
reprec.assertoutcome(passed=2)
|
reprec.assertoutcome(passed=2)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('strict', [True, False])
|
@pytest.mark.parametrize('strict', [True, False])
|
||||||
def test_parametrize_marked_value(self, testdir, strict):
|
def test_parametrize_marked_value(self, testdir, strict):
|
||||||
s = """
|
s = """
|
||||||
|
@ -1476,7 +1472,6 @@ class TestMarkersWithParametrization(object):
|
||||||
passed, failed = (0, 2) if strict else (2, 0)
|
passed, failed = (0, 2) if strict else (2, 0)
|
||||||
reprec.assertoutcome(passed=passed, failed=failed)
|
reprec.assertoutcome(passed=passed, failed=failed)
|
||||||
|
|
||||||
|
|
||||||
def test_pytest_make_parametrize_id(self, testdir):
|
def test_pytest_make_parametrize_id(self, testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_make_parametrize_id(config, val):
|
def pytest_make_parametrize_id(config, val):
|
||||||
|
|
|
@ -118,7 +118,6 @@ class TestRaises(object):
|
||||||
for o in gc.get_objects():
|
for o in gc.get_objects():
|
||||||
assert type(o) is not T
|
assert type(o) is not T
|
||||||
|
|
||||||
|
|
||||||
def test_raises_match(self):
|
def test_raises_match(self):
|
||||||
msg = r"with base \d+"
|
msg = r"with base \d+"
|
||||||
with pytest.raises(ValueError, match=msg):
|
with pytest.raises(ValueError, match=msg):
|
||||||
|
|
|
@ -89,7 +89,6 @@ class TestNewAPI(object):
|
||||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_cache_reportheader(testdir):
|
def test_cache_reportheader(testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
def test_hello():
|
def test_hello():
|
||||||
|
@ -339,7 +338,6 @@ class TestLastFailed(object):
|
||||||
lastfailed = rlf(fail_import=0, fail_run=1)
|
lastfailed = rlf(fail_import=0, fail_run=1)
|
||||||
assert list(lastfailed) == ['test_maybe.py::test_hello']
|
assert list(lastfailed) == ['test_maybe.py::test_hello']
|
||||||
|
|
||||||
|
|
||||||
def test_lastfailed_failure_subset(self, testdir, monkeypatch):
|
def test_lastfailed_failure_subset(self, testdir, monkeypatch):
|
||||||
|
|
||||||
testdir.makepyfile(test_maybe="""
|
testdir.makepyfile(test_maybe="""
|
||||||
|
@ -381,12 +379,10 @@ class TestLastFailed(object):
|
||||||
result, lastfailed = rlf(fail_import=1, fail_run=0)
|
result, lastfailed = rlf(fail_import=1, fail_run=0)
|
||||||
assert sorted(list(lastfailed)) == ['test_maybe.py', 'test_maybe2.py']
|
assert sorted(list(lastfailed)) == ['test_maybe.py', 'test_maybe2.py']
|
||||||
|
|
||||||
|
|
||||||
result, lastfailed = rlf(fail_import=0, fail_run=0,
|
result, lastfailed = rlf(fail_import=0, fail_run=0,
|
||||||
args=('test_maybe2.py',))
|
args=('test_maybe2.py',))
|
||||||
assert list(lastfailed) == ['test_maybe.py']
|
assert list(lastfailed) == ['test_maybe.py']
|
||||||
|
|
||||||
|
|
||||||
# edge case of test selection - even if we remember failures
|
# edge case of test selection - even if we remember failures
|
||||||
# from other tests we still need to run all tests if no test
|
# from other tests we still need to run all tests if no test
|
||||||
# matches the failures
|
# matches the failures
|
||||||
|
|
|
@ -49,7 +49,6 @@ def oswritebytes(fd, obj):
|
||||||
os.write(fd, tobytes(obj))
|
os.write(fd, tobytes(obj))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def StdCaptureFD(out=True, err=True, in_=True):
|
def StdCaptureFD(out=True, err=True, in_=True):
|
||||||
return capture.MultiCapture(out, err, in_, Capture=capture.FDCapture)
|
return capture.MultiCapture(out, err, in_, Capture=capture.FDCapture)
|
||||||
|
|
||||||
|
@ -1076,7 +1075,6 @@ def test_close_and_capture_again(testdir):
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('method', ['SysCapture', 'FDCapture'])
|
@pytest.mark.parametrize('method', ['SysCapture', 'FDCapture'])
|
||||||
def test_capturing_and_logging_fundamentals(testdir, method):
|
def test_capturing_and_logging_fundamentals(testdir, method):
|
||||||
if method == "StdCaptureFD" and not hasattr(os, 'dup'):
|
if method == "StdCaptureFD" and not hasattr(os, 'dup'):
|
||||||
|
|
|
@ -69,7 +69,6 @@ class TestCollector(object):
|
||||||
parent = fn.getparent(pytest.Class)
|
parent = fn.getparent(pytest.Class)
|
||||||
assert parent is cls
|
assert parent is cls
|
||||||
|
|
||||||
|
|
||||||
def test_getcustomfile_roundtrip(self, testdir):
|
def test_getcustomfile_roundtrip(self, testdir):
|
||||||
hello = testdir.makefile(".xxx", hello="world")
|
hello = testdir.makefile(".xxx", hello="world")
|
||||||
testdir.makepyfile(conftest="""
|
testdir.makepyfile(conftest="""
|
||||||
|
|
|
@ -731,7 +731,6 @@ class TestOverrideIniArgs(object):
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
result.stdout.fnmatch_lines(["custom_option:3.0"])
|
result.stdout.fnmatch_lines(["custom_option:3.0"])
|
||||||
|
|
||||||
|
|
||||||
def test_override_ini_pathlist(self, testdir):
|
def test_override_ini_pathlist(self, testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
|
|
@ -294,7 +294,6 @@ class TestDoctests(object):
|
||||||
"*:5: DocTestFailure"
|
"*:5: DocTestFailure"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_txtfile_failing(self, testdir):
|
def test_txtfile_failing(self, testdir):
|
||||||
p = testdir.maketxtfile("""
|
p = testdir.maketxtfile("""
|
||||||
>>> i = 0
|
>>> i = 0
|
||||||
|
|
|
@ -462,7 +462,6 @@ class TestFunctional(object):
|
||||||
items, rec = testdir.inline_genitems(p)
|
items, rec = testdir.inline_genitems(p)
|
||||||
self.assert_markers(items, test_foo=('a', 'b'), test_bar=('a',))
|
self.assert_markers(items, test_foo=('a', 'b'), test_bar=('a',))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.issue568
|
@pytest.mark.issue568
|
||||||
@pytest.mark.xfail(reason="markers smear on methods of base classes")
|
@pytest.mark.xfail(reason="markers smear on methods of base classes")
|
||||||
def test_mark_should_not_pass_to_siebling_class(self, testdir):
|
def test_mark_should_not_pass_to_siebling_class(self, testdir):
|
||||||
|
@ -487,7 +486,6 @@ class TestFunctional(object):
|
||||||
assert not hasattr(base_item.obj, 'b')
|
assert not hasattr(base_item.obj, 'b')
|
||||||
assert not hasattr(sub_item_other.obj, 'b')
|
assert not hasattr(sub_item_other.obj, 'b')
|
||||||
|
|
||||||
|
|
||||||
def test_mark_decorator_baseclasses_merged(self, testdir):
|
def test_mark_decorator_baseclasses_merged(self, testdir):
|
||||||
p = testdir.makepyfile("""
|
p = testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -33,7 +33,6 @@ def custom_pdb_calls():
|
||||||
return called
|
return called
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestPDB(object):
|
class TestPDB(object):
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -377,7 +376,6 @@ class TestPDB(object):
|
||||||
])
|
])
|
||||||
assert custom_pdb_calls == ["init", "reset", "interaction"]
|
assert custom_pdb_calls == ["init", "reset", "interaction"]
|
||||||
|
|
||||||
|
|
||||||
def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls):
|
def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls):
|
||||||
p1 = testdir.makepyfile("""xxx """)
|
p1 = testdir.makepyfile("""xxx """)
|
||||||
result = testdir.runpytest_inprocess(
|
result = testdir.runpytest_inprocess(
|
||||||
|
|
|
@ -295,7 +295,6 @@ class TestWarns(object):
|
||||||
assert str(record[0].message) == "user"
|
assert str(record[0].message) == "user"
|
||||||
assert str(record[1].message) == "runtime"
|
assert str(record[1].message) == "runtime"
|
||||||
|
|
||||||
|
|
||||||
def test_double_test(self, testdir):
|
def test_double_test(self, testdir):
|
||||||
"""If a test is run again, the warning should still be raised"""
|
"""If a test is run again, the warning should still be raised"""
|
||||||
testdir.makepyfile('''
|
testdir.makepyfile('''
|
||||||
|
|
|
@ -350,7 +350,6 @@ class TestXFail(object):
|
||||||
"*1 xfailed*",
|
"*1 xfailed*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('expected, actual, matchline',
|
@pytest.mark.parametrize('expected, actual, matchline',
|
||||||
[('TypeError', 'TypeError', "*1 xfailed*"),
|
[('TypeError', 'TypeError', "*1 xfailed*"),
|
||||||
('(AttributeError, TypeError)', 'TypeError', "*1 xfailed*"),
|
('(AttributeError, TypeError)', 'TypeError', "*1 xfailed*"),
|
||||||
|
|
|
@ -734,7 +734,6 @@ class TestGenericReporting(object):
|
||||||
"*2 failed*",
|
"*2 failed*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_tb_option(self, testdir, option):
|
def test_tb_option(self, testdir, option):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -113,7 +113,6 @@ def test_ignore(testdir, pyfile_with_warnings, method):
|
||||||
assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
|
assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 0),
|
@pytest.mark.skipif(sys.version_info < (3, 0),
|
||||||
reason='warnings message is unicode is ok in python3')
|
reason='warnings message is unicode is ok in python3')
|
||||||
def test_unicode(testdir, pyfile_with_warnings):
|
def test_unicode(testdir, pyfile_with_warnings):
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -196,6 +196,6 @@ filterwarnings =
|
||||||
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
|
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E303,E401,E402,E501,E701,E702,E704,E712,E731
|
ignore = E401,E402,E501,E701,E702,E704,E712,E731
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude = _pytest/vendored_packages/pluggy.py
|
exclude = _pytest/vendored_packages/pluggy.py
|
||||||
|
|
Loading…
Reference in New Issue