New-style classes implemented for python 2.7 - #2147
This commit is contained in:
parent
da828aac05
commit
fb0b90646e
1
AUTHORS
1
AUTHORS
|
@ -108,6 +108,7 @@ Michael Aquilina
|
|||
Michael Birtwell
|
||||
Michael Droettboom
|
||||
Michael Seifert
|
||||
Michal Wajszczuk
|
||||
Mike Lundy
|
||||
Ned Batchelder
|
||||
Neven Mundar
|
||||
|
|
|
@ -21,7 +21,7 @@ Changes
|
|||
-------
|
||||
|
||||
* Old-style classes have been changed to new-style classes in order to improve
|
||||
compatability with Python 2. Thanks to `@mandeep`_ for the PR (`#2147`_).
|
||||
compatibility with Python 2. Thanks to `@MichalTHEDUDE`_ and `@mandeep`_ for the PR (`#2147`_).
|
||||
|
||||
* It is now possible to skip test classes from being collected by setting a
|
||||
``__test__`` attribute to ``False`` in the class body (`#2007`_). Thanks
|
||||
|
@ -61,6 +61,7 @@ Changes
|
|||
.. _@wheerd: https://github.com/wheerd
|
||||
.. _@fogo: https://github.com/fogo
|
||||
.. _@mandeep: https://github.com/mandeep
|
||||
.. _@MichalTHEDUDE: https://github.com/MichalTHEDUDE
|
||||
.. _@unsignedint: https://github.com/unsignedint
|
||||
.. _@Kriechi: https://github.com/Kriechi
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ def normalize_hookimpl_opts(opts):
|
|||
opts.setdefault("optionalhook", False)
|
||||
|
||||
|
||||
class _TagTracer:
|
||||
class _TagTracer(object):
|
||||
def __init__(self):
|
||||
self._tag2proc = {}
|
||||
self.writer = None
|
||||
|
@ -214,7 +214,7 @@ class _TagTracer:
|
|||
self._tag2proc[tags] = processor
|
||||
|
||||
|
||||
class _TagTracerSub:
|
||||
class _TagTracerSub(object):
|
||||
def __init__(self, root, tags):
|
||||
self.root = root
|
||||
self.tags = tags
|
||||
|
@ -254,7 +254,7 @@ def _wrapped_call(wrap_controller, func):
|
|||
return call_outcome.get_result()
|
||||
|
||||
|
||||
class _CallOutcome:
|
||||
class _CallOutcome(object):
|
||||
""" Outcome of a function call, either an exception or a proper result.
|
||||
Calling the ``get_result`` method will return the result or reraise
|
||||
the exception raised when the function was called. """
|
||||
|
@ -286,7 +286,7 @@ def _reraise(cls, val, tb):
|
|||
""")
|
||||
|
||||
|
||||
class _TracedHookExecution:
|
||||
class _TracedHookExecution(object):
|
||||
def __init__(self, pluginmanager, before, after):
|
||||
self.pluginmanager = pluginmanager
|
||||
self.before = before
|
||||
|
@ -580,7 +580,7 @@ class PluginManager(object):
|
|||
return orig
|
||||
|
||||
|
||||
class _MultiCall:
|
||||
class _MultiCall(object):
|
||||
""" execute a call into multiple python functions/methods. """
|
||||
|
||||
# XXX note that the __multicall__ argument is supported only
|
||||
|
@ -673,7 +673,7 @@ def varnames(func, startindex=None):
|
|||
return x
|
||||
|
||||
|
||||
class _HookRelay:
|
||||
class _HookRelay(object):
|
||||
""" hook holder object for performing 1:N hook calls where N is the number
|
||||
of registered plugins.
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ provides an alternative explanation for ``Foo`` objects::
|
|||
now, given this test module::
|
||||
|
||||
# content of test_foocompare.py
|
||||
class Foo:
|
||||
class Foo(object):
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ def test_attribute_multiple():
|
|||
def globf(x):
|
||||
return x+1
|
||||
|
||||
class TestRaises:
|
||||
class TestRaises(object):
|
||||
def test_raises(self):
|
||||
s = 'qwe'
|
||||
raises(TypeError, "int(s)")
|
||||
|
@ -167,7 +167,7 @@ def test_dynamic_compile_shows_nicely():
|
|||
|
||||
|
||||
|
||||
class TestMoreErrors:
|
||||
class TestMoreErrors(object):
|
||||
def test_complex_error(self):
|
||||
def f():
|
||||
return 44
|
||||
|
@ -213,23 +213,23 @@ class TestMoreErrors:
|
|||
x = 0
|
||||
|
||||
|
||||
class TestCustomAssertMsg:
|
||||
class TestCustomAssertMsg(object):
|
||||
|
||||
def test_single_line(self):
|
||||
class A:
|
||||
class A(object):
|
||||
a = 1
|
||||
b = 2
|
||||
assert A.a == b, "A.a appears not to be b"
|
||||
|
||||
def test_multiline(self):
|
||||
class A:
|
||||
class A(object):
|
||||
a = 1
|
||||
b = 2
|
||||
assert A.a == b, "A.a appears not to be b\n" \
|
||||
"or does not appear to be b\none of those"
|
||||
|
||||
def test_custom_repr(self):
|
||||
class JSON:
|
||||
class JSON(object):
|
||||
a = 1
|
||||
def __repr__(self):
|
||||
return "This is JSON\n{\n 'foo': 'bar'\n}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
def setup_module(module):
|
||||
module.TestStateFullThing.classcount = 0
|
||||
|
||||
class TestStateFullThing:
|
||||
class TestStateFullThing(object):
|
||||
def setup_class(cls):
|
||||
cls.classcount += 1
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ example: specifying and selecting acceptance tests
|
|||
def pytest_funcarg__accept(request):
|
||||
return AcceptFixture(request)
|
||||
|
||||
class AcceptFixture:
|
||||
class AcceptFixture(object):
|
||||
def __init__(self, request):
|
||||
if not request.config.option.acceptance:
|
||||
pytest.skip("specify -A to run acceptance tests")
|
||||
|
@ -61,7 +61,7 @@ extend the `accept example`_ by putting this in our test module:
|
|||
arg.tmpdir.mkdir("special")
|
||||
return arg
|
||||
|
||||
class TestSpecialAcceptance:
|
||||
class TestSpecialAcceptance(object):
|
||||
def test_sometest(self, accept):
|
||||
assert accept.tmpdir.join("special").check()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ def setup(request):
|
|||
yield setup
|
||||
setup.finalize()
|
||||
|
||||
class CostlySetup:
|
||||
class CostlySetup(object):
|
||||
def __init__(self):
|
||||
import time
|
||||
print ("performing costly setup")
|
||||
|
|
|
@ -21,7 +21,7 @@ You can "mark" a test function with custom metadata like this::
|
|||
pass
|
||||
def test_another():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
|
||||
|
@ -242,7 +242,7 @@ its test methods::
|
|||
# content of test_mark_classlevel.py
|
||||
import pytest
|
||||
@pytest.mark.webtest
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_startup(self):
|
||||
pass
|
||||
def test_startup_and_more(self):
|
||||
|
@ -256,14 +256,14 @@ To remain backward-compatible with Python 2.4 you can also set a
|
|||
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = pytest.mark.webtest
|
||||
|
||||
or if you need to use multiple markers you can use a list::
|
||||
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = [pytest.mark.webtest, pytest.mark.slowtest]
|
||||
|
||||
You can also set a module level marker::
|
||||
|
@ -407,7 +407,7 @@ code you can read over all such settings. Example::
|
|||
pytestmark = pytest.mark.glob("module", x=1)
|
||||
|
||||
@pytest.mark.glob("class", x=2)
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.mark.glob("function", x=3)
|
||||
def test_something(self):
|
||||
pass
|
||||
|
|
|
@ -16,7 +16,7 @@ def python1(request, tmpdir):
|
|||
def python2(request, python1):
|
||||
return Python(request.param, python1.picklefile)
|
||||
|
||||
class Python:
|
||||
class Python(object):
|
||||
def __init__(self, version, picklefile):
|
||||
self.pythonpath = py.path.local.sysfind(version)
|
||||
if not self.pythonpath:
|
||||
|
|
|
@ -168,7 +168,7 @@ only have to work a bit to construct the correct arguments for pytest's
|
|||
scenario1 = ('basic', {'attribute': 'value'})
|
||||
scenario2 = ('advanced', {'attribute': 'value2'})
|
||||
|
||||
class TestSampleWithScenarios:
|
||||
class TestSampleWithScenarios(object):
|
||||
scenarios = [scenario1, scenario2]
|
||||
|
||||
def test_demo1(self, attribute):
|
||||
|
@ -241,9 +241,9 @@ creates a database object for the actual test invocations::
|
|||
if 'db' in metafunc.fixturenames:
|
||||
metafunc.parametrize("db", ['d1', 'd2'], indirect=True)
|
||||
|
||||
class DB1:
|
||||
class DB1(object):
|
||||
"one database object"
|
||||
class DB2:
|
||||
class DB2(object):
|
||||
"alternative database object"
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -350,7 +350,7 @@ parametrizer`_ but in a lot less code::
|
|||
metafunc.parametrize(argnames, [[funcargs[name] for name in argnames]
|
||||
for funcargs in funcarglist])
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
# a map specifying multiple argument sets for a test method
|
||||
params = {
|
||||
'test_equals': [dict(a=1, b=2), dict(a=3, b=3), ],
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
def test_function():
|
||||
pass
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
def test_anothermethod(self):
|
||||
|
|
|
@ -107,7 +107,7 @@ This would make ``pytest`` look for tests in files that match the ``check_*
|
|||
that match ``*_check``. For example, if we have::
|
||||
|
||||
# content of check_myapp.py
|
||||
class CheckMyApp:
|
||||
class CheckMyApp(object):
|
||||
def simple_check(self):
|
||||
pass
|
||||
def complex_check(self):
|
||||
|
|
|
@ -550,7 +550,7 @@ get on the terminal - we are working on that)::
|
|||
self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
|
||||
|
||||
def test_single_line(self):
|
||||
class A:
|
||||
class A(object):
|
||||
a = 1
|
||||
b = 2
|
||||
> assert A.a == b, "A.a appears not to be b"
|
||||
|
@ -564,7 +564,7 @@ get on the terminal - we are working on that)::
|
|||
self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
|
||||
|
||||
def test_multiline(self):
|
||||
class A:
|
||||
class A(object):
|
||||
a = 1
|
||||
b = 2
|
||||
> assert A.a == b, "A.a appears not to be b\n" \
|
||||
|
@ -581,7 +581,7 @@ get on the terminal - we are working on that)::
|
|||
self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
|
||||
|
||||
def test_custom_repr(self):
|
||||
class JSON:
|
||||
class JSON(object):
|
||||
a = 1
|
||||
def __repr__(self):
|
||||
return "This is JSON\n{\n 'foo': 'bar'\n}"
|
||||
|
|
|
@ -425,7 +425,7 @@ tests in a class. Here is a test module example:
|
|||
import pytest
|
||||
|
||||
@pytest.mark.incremental
|
||||
class TestUserHandling:
|
||||
class TestUserHandling(object):
|
||||
def test_login(self):
|
||||
pass
|
||||
def test_modification(self):
|
||||
|
@ -483,7 +483,7 @@ Here is an example for making a ``db`` fixture available in a directory:
|
|||
# content of a/conftest.py
|
||||
import pytest
|
||||
|
||||
class DB:
|
||||
class DB(object):
|
||||
pass
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
|
@ -28,7 +28,7 @@ will be called ahead of running any tests::
|
|||
|
||||
# content of test_module.py
|
||||
|
||||
class TestHello:
|
||||
class TestHello(object):
|
||||
@classmethod
|
||||
def callme(cls):
|
||||
print ("callme called!")
|
||||
|
@ -39,7 +39,7 @@ will be called ahead of running any tests::
|
|||
def test_method2(self):
|
||||
print ("test_method1 called")
|
||||
|
||||
class TestOther:
|
||||
class TestOther(object):
|
||||
@classmethod
|
||||
def callme(cls):
|
||||
print ("callme other called")
|
||||
|
|
|
@ -557,7 +557,7 @@ and instantiate an object ``app`` where we stick the already defined
|
|||
|
||||
import pytest
|
||||
|
||||
class App:
|
||||
class App(object):
|
||||
def __init__(self, smtp):
|
||||
self.smtp = smtp
|
||||
|
||||
|
@ -728,7 +728,7 @@ and declare its use in a test module via a ``usefixtures`` marker::
|
|||
import pytest
|
||||
|
||||
@pytest.mark.usefixtures("cleandir")
|
||||
class TestDirectoryInit:
|
||||
class TestDirectoryInit(object):
|
||||
def test_cwd_starts_empty(self):
|
||||
assert os.listdir(os.getcwd()) == []
|
||||
with open("myfile", "w") as f:
|
||||
|
@ -791,7 +791,7 @@ self-contained implementation of this idea::
|
|||
|
||||
import pytest
|
||||
|
||||
class DB:
|
||||
class DB(object):
|
||||
def __init__(self):
|
||||
self.intransaction = []
|
||||
def begin(self, name):
|
||||
|
@ -803,7 +803,7 @@ self-contained implementation of this idea::
|
|||
def db():
|
||||
return DB()
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.fixture(autouse=True)
|
||||
def transact(self, request, db):
|
||||
db.begin(request.function.__name__)
|
||||
|
@ -861,7 +861,7 @@ into a conftest.py file **without** using ``autouse``::
|
|||
and then e.g. have a TestClass using it by declaring the need::
|
||||
|
||||
@pytest.mark.usefixtures("transact")
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method1(self):
|
||||
...
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ resources. Here is a basic example how we could implement
|
|||
a per-session Database object::
|
||||
|
||||
# content of conftest.py
|
||||
class Database:
|
||||
class Database(object):
|
||||
def __init__(self):
|
||||
print ("database instance created")
|
||||
def destroy(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import textwrap
|
||||
import inspect
|
||||
|
||||
class Writer:
|
||||
class Writer(object):
|
||||
def __init__(self, clsname):
|
||||
self.clsname = clsname
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ to group tests logically, in classes and modules. Let's write a class
|
|||
containing two tests::
|
||||
|
||||
# content of test_class.py
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_one(self):
|
||||
x = "this"
|
||||
assert 'h' in x
|
||||
|
|
|
@ -98,7 +98,7 @@ You can use the ``skipif`` decorator (and any other marker) on classes::
|
|||
|
||||
@pytest.mark.skipif(sys.platform == 'win32',
|
||||
reason="does not run on windows")
|
||||
class TestPosixCalls:
|
||||
class TestPosixCalls(object):
|
||||
|
||||
def test_function(self):
|
||||
"will not be setup or run under 'win32' platform"
|
||||
|
|
|
@ -110,7 +110,7 @@ If you want to disable a complete test class you
|
|||
can set the class-level attribute ``disabled``.
|
||||
For example, in order to avoid running some tests on Win32::
|
||||
|
||||
class TestPosixOnly:
|
||||
class TestPosixOnly(object):
|
||||
disabled = sys.platform == 'win32'
|
||||
|
||||
def test_xxx(self):
|
||||
|
|
|
@ -71,7 +71,7 @@ it from a unittest-style test::
|
|||
|
||||
@pytest.fixture(scope="class")
|
||||
def db_class(request):
|
||||
class DummyDB:
|
||||
class DummyDB(object):
|
||||
pass
|
||||
# set a class attribute on the invoking test context
|
||||
request.cls.db = DummyDB()
|
||||
|
|
|
@ -226,7 +226,7 @@ to all testcases you can use ``LogXML.add_global_properties``
|
|||
def start_and_prepare_env():
|
||||
pass
|
||||
|
||||
class TestMe:
|
||||
class TestMe(object):
|
||||
def test_foo(self):
|
||||
assert True
|
||||
|
||||
|
@ -314,7 +314,7 @@ You can specify additional plugins to ``pytest.main``::
|
|||
|
||||
# content of myinvoke.py
|
||||
import pytest
|
||||
class MyPlugin:
|
||||
class MyPlugin(object):
|
||||
def pytest_sessionfinish(self):
|
||||
print("*** test run reporting finishing")
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import pytest
|
|||
from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR
|
||||
|
||||
|
||||
class TestGeneralUsage:
|
||||
class TestGeneralUsage(object):
|
||||
def test_config_error(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
def pytest_configure(config):
|
||||
|
@ -410,7 +410,7 @@ class TestGeneralUsage:
|
|||
])
|
||||
|
||||
|
||||
class TestInvocationVariants:
|
||||
class TestInvocationVariants(object):
|
||||
def test_earlyinit(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -502,7 +502,7 @@ class TestInvocationVariants:
|
|||
out, err = capsys.readouterr()
|
||||
|
||||
def test_invoke_plugin_api(self, testdir, capsys):
|
||||
class MyPlugin:
|
||||
class MyPlugin(object):
|
||||
def pytest_addoption(self, parser):
|
||||
parser.addoption("--myopt")
|
||||
|
||||
|
@ -670,7 +670,7 @@ class TestInvocationVariants:
|
|||
assert request.config.pluginmanager.hasplugin('python')
|
||||
|
||||
|
||||
class TestDurations:
|
||||
class TestDurations(object):
|
||||
source = """
|
||||
import time
|
||||
frag = 0.002
|
||||
|
@ -741,7 +741,7 @@ class TestDurations:
|
|||
assert result.ret == 0
|
||||
|
||||
|
||||
class TestDurationWithFixture:
|
||||
class TestDurationWithFixture(object):
|
||||
source = """
|
||||
import time
|
||||
frag = 0.001
|
||||
|
|
|
@ -20,7 +20,7 @@ def test_code_gives_back_name_for_not_existing_file():
|
|||
assert code.fullsource is None
|
||||
|
||||
def test_code_with_class():
|
||||
class A:
|
||||
class A(object):
|
||||
pass
|
||||
pytest.raises(TypeError, "_pytest._code.Code(A)")
|
||||
|
||||
|
@ -136,7 +136,7 @@ def test_frame_getargs():
|
|||
('z', {'c': 'd'})]
|
||||
|
||||
|
||||
class TestExceptionInfo:
|
||||
class TestExceptionInfo(object):
|
||||
|
||||
def test_bad_getsource(self):
|
||||
try:
|
||||
|
@ -147,7 +147,7 @@ class TestExceptionInfo:
|
|||
assert exci.getrepr()
|
||||
|
||||
|
||||
class TestTracebackEntry:
|
||||
class TestTracebackEntry(object):
|
||||
|
||||
def test_getsource(self):
|
||||
try:
|
||||
|
|
|
@ -25,7 +25,7 @@ else:
|
|||
import pytest
|
||||
pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3]))
|
||||
|
||||
class TWMock:
|
||||
class TWMock(object):
|
||||
WRITE = object()
|
||||
|
||||
def __init__(self):
|
||||
|
@ -89,7 +89,7 @@ def h():
|
|||
g()
|
||||
#
|
||||
|
||||
class TestTraceback_f_g_h:
|
||||
class TestTraceback_f_g_h(object):
|
||||
def setup_method(self, method):
|
||||
try:
|
||||
h()
|
||||
|
@ -386,7 +386,7 @@ def test_match_raises_error(testdir):
|
|||
"*AssertionError*Pattern*[123]*not found*",
|
||||
])
|
||||
|
||||
class TestFormattedExcinfo:
|
||||
class TestFormattedExcinfo(object):
|
||||
|
||||
@pytest.fixture
|
||||
def importasmod(self, request):
|
||||
|
@ -472,7 +472,7 @@ raise ValueError()
|
|||
pr = FormattedExcinfo()
|
||||
|
||||
class FakeCode(object):
|
||||
class raw:
|
||||
class raw(object):
|
||||
co_filename = '?'
|
||||
|
||||
path = '?'
|
||||
|
|
|
@ -49,7 +49,7 @@ def test_source_from_function():
|
|||
assert str(source).startswith('def test_source_str_function():')
|
||||
|
||||
def test_source_from_method():
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
source = _pytest._code.Source(TestClass().test_method)
|
||||
|
@ -119,7 +119,7 @@ def test_isparseable():
|
|||
assert not Source(" \nif 1:\npass").isparseable()
|
||||
assert not Source(chr(0)).isparseable()
|
||||
|
||||
class TestAccesses:
|
||||
class TestAccesses(object):
|
||||
source = Source("""\
|
||||
def f(x):
|
||||
pass
|
||||
|
@ -143,7 +143,7 @@ class TestAccesses:
|
|||
l = [x for x in self.source]
|
||||
assert len(l) == 4
|
||||
|
||||
class TestSourceParsingAndCompiling:
|
||||
class TestSourceParsingAndCompiling(object):
|
||||
source = Source("""\
|
||||
def f(x):
|
||||
assert (x ==
|
||||
|
@ -307,7 +307,7 @@ class TestSourceParsingAndCompiling:
|
|||
pytest.raises(SyntaxError, _pytest._code.compile, "lambda a,a: 0", mode='eval')
|
||||
|
||||
def test_getstartingblock_singleline():
|
||||
class A:
|
||||
class A(object):
|
||||
def __init__(self, *args):
|
||||
frame = sys._getframe(1)
|
||||
self.source = _pytest._code.Frame(frame).statement
|
||||
|
@ -318,7 +318,7 @@ def test_getstartingblock_singleline():
|
|||
assert len(l) == 1
|
||||
|
||||
def test_getstartingblock_multiline():
|
||||
class A:
|
||||
class A(object):
|
||||
def __init__(self, *args):
|
||||
frame = sys._getframe(1)
|
||||
self.source = _pytest._code.Frame(frame).statement
|
||||
|
@ -461,16 +461,16 @@ def test_getfslineno():
|
|||
assert lineno == A_lineno
|
||||
|
||||
assert getfslineno(3) == ("", -1)
|
||||
class B:
|
||||
class B(object):
|
||||
pass
|
||||
B.__name__ = "B2"
|
||||
assert getfslineno(B)[1] == -1
|
||||
|
||||
def test_code_of_object_instance_with_call():
|
||||
class A:
|
||||
class A(object):
|
||||
pass
|
||||
pytest.raises(TypeError, lambda: _pytest._code.Source(A()))
|
||||
class WithCall:
|
||||
class WithCall(object):
|
||||
def __call__(self):
|
||||
pass
|
||||
|
||||
|
@ -559,7 +559,7 @@ x = 3
|
|||
""")
|
||||
assert str(source) == "raise ValueError(\n 23\n)"
|
||||
|
||||
class TestTry:
|
||||
class TestTry(object):
|
||||
pytestmark = astonly
|
||||
source = """\
|
||||
try:
|
||||
|
@ -586,7 +586,7 @@ else:
|
|||
source = getstatement(5, self.source)
|
||||
assert str(source) == " raise KeyError()"
|
||||
|
||||
class TestTryFinally:
|
||||
class TestTryFinally(object):
|
||||
source = """\
|
||||
try:
|
||||
raise ValueError
|
||||
|
@ -604,7 +604,7 @@ finally:
|
|||
|
||||
|
||||
|
||||
class TestIf:
|
||||
class TestIf(object):
|
||||
pytestmark = astonly
|
||||
source = """\
|
||||
if 1:
|
||||
|
|
|
@ -48,7 +48,7 @@ def test_str_args_deprecated(tmpdir, testdir):
|
|||
from _pytest.main import EXIT_NOTESTSCOLLECTED
|
||||
warnings = []
|
||||
|
||||
class Collect:
|
||||
class Collect(object):
|
||||
def pytest_logwarning(self, message):
|
||||
warnings.append(message)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class MyDocTestRunner(doctest.DocTestRunner):
|
|||
example.source.strip(), got.strip(), example.want.strip()))
|
||||
|
||||
|
||||
class TestApprox:
|
||||
class TestApprox(object):
|
||||
|
||||
def test_repr_string(self):
|
||||
# for some reason in Python 2.6 it is not displaying the tolerance representation correctly
|
||||
|
|
|
@ -12,7 +12,7 @@ from _pytest.main import (
|
|||
)
|
||||
|
||||
|
||||
class TestModule:
|
||||
class TestModule(object):
|
||||
def test_failing_import(self, testdir):
|
||||
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
|
||||
pytest.raises(Collector.CollectError, modcol.collect)
|
||||
|
@ -105,10 +105,10 @@ class TestModule:
|
|||
assert name not in stdout
|
||||
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_class_with_init_warning(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
class TestClass1:
|
||||
class TestClass1(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -129,7 +129,7 @@ class TestClass:
|
|||
|
||||
def test_setup_teardown_class_as_classmethod(self, testdir):
|
||||
testdir.makepyfile(test_mod1="""
|
||||
class TestClassMethod:
|
||||
class TestClassMethod(object):
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
pass
|
||||
|
@ -167,7 +167,7 @@ class TestClass:
|
|||
)
|
||||
|
||||
|
||||
class TestGenerator:
|
||||
class TestGenerator(object):
|
||||
def test_generative_functions(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def func1(arg, arg2):
|
||||
|
@ -192,7 +192,7 @@ class TestGenerator:
|
|||
modcol = testdir.getmodulecol("""
|
||||
def func1(arg, arg2):
|
||||
assert arg == arg2
|
||||
class TestGenMethods:
|
||||
class TestGenMethods(object):
|
||||
def test_gen(self):
|
||||
yield func1, 17, 3*5
|
||||
yield func1, 42, 6*7
|
||||
|
@ -246,7 +246,7 @@ class TestGenerator:
|
|||
modcol = testdir.getmodulecol("""
|
||||
def func1(arg, arg2):
|
||||
assert arg == arg2
|
||||
class TestGenMethods:
|
||||
class TestGenMethods(object):
|
||||
def test_gen(self):
|
||||
yield "m1", func1, 17, 3*5
|
||||
yield "m2", func1, 42, 6*7
|
||||
|
@ -326,7 +326,7 @@ class TestGenerator:
|
|||
# has been used during collection.
|
||||
o = testdir.makepyfile("""
|
||||
setuplist = []
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def setup_method(self, func):
|
||||
#print "setup_method", self, func
|
||||
setuplist.append(self)
|
||||
|
@ -360,7 +360,7 @@ class TestGenerator:
|
|||
assert not skipped and not failed
|
||||
|
||||
|
||||
class TestFunction:
|
||||
class TestFunction(object):
|
||||
def test_getmodulecollector(self, testdir):
|
||||
item = testdir.getitem("def test_func(): pass")
|
||||
modcol = item.getparent(pytest.Module)
|
||||
|
@ -369,7 +369,7 @@ class TestFunction:
|
|||
|
||||
def test_function_as_object_instance_ignored(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
class A:
|
||||
class A(object):
|
||||
def __call__(self, tmpdir):
|
||||
0/0
|
||||
|
||||
|
@ -420,7 +420,7 @@ class TestFunction:
|
|||
def test_issue213_parametrize_value_no_equal(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
class A:
|
||||
class A(object):
|
||||
def __eq__(self, other):
|
||||
raise ValueError("not possible")
|
||||
@pytest.mark.parametrize('arg', [A()])
|
||||
|
@ -551,11 +551,11 @@ class TestFunction:
|
|||
item = testdir.getitem("def test_func(): raise ValueError")
|
||||
config = item.config
|
||||
|
||||
class MyPlugin1:
|
||||
class MyPlugin1(object):
|
||||
def pytest_pyfunc_call(self, pyfuncitem):
|
||||
raise ValueError
|
||||
|
||||
class MyPlugin2:
|
||||
class MyPlugin2(object):
|
||||
def pytest_pyfunc_call(self, pyfuncitem):
|
||||
return True
|
||||
|
||||
|
@ -683,7 +683,7 @@ class TestFunction:
|
|||
assert [x.originalname for x in items] == ['test_func', 'test_func']
|
||||
|
||||
|
||||
class TestSorting:
|
||||
class TestSorting(object):
|
||||
def test_check_equality(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def test_pass(): pass
|
||||
|
@ -733,7 +733,7 @@ class TestSorting:
|
|||
assert [item.name for item in colitems] == ['test_b', 'test_a']
|
||||
|
||||
|
||||
class TestConftestCustomization:
|
||||
class TestConftestCustomization(object):
|
||||
def test_pytest_pycollect_module(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
@ -847,7 +847,7 @@ def test_modulecol_roundtrip(testdir):
|
|||
assert modcol.name == newcol.name
|
||||
|
||||
|
||||
class TestTracebackCutting:
|
||||
class TestTracebackCutting(object):
|
||||
def test_skip_simple(self):
|
||||
excinfo = pytest.raises(pytest.skip.Exception, 'pytest.skip("xxx")')
|
||||
assert excinfo.traceback[-1].frame.code.name == "skip"
|
||||
|
@ -973,7 +973,7 @@ class TestTracebackCutting:
|
|||
assert filter_traceback(tb[-1])
|
||||
|
||||
|
||||
class TestReportInfo:
|
||||
class TestReportInfo(object):
|
||||
def test_itemreport_reportinfo(self, testdir, linecomp):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
@ -998,7 +998,7 @@ class TestReportInfo:
|
|||
def test_class_reportinfo(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
# lineno 0
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_hello(self): pass
|
||||
""")
|
||||
classcol = testdir.collect_by_name(modcol, "TestClass")
|
||||
|
@ -1033,7 +1033,7 @@ class TestReportInfo:
|
|||
def check(x):
|
||||
pass
|
||||
yield check, 3
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
"""
|
||||
|
@ -1042,7 +1042,7 @@ class TestReportInfo:
|
|||
# https://github.com/pytest-dev/pytest/issues/1204
|
||||
modcol = testdir.getmodulecol("""
|
||||
# lineno 0
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def __getattr__(self, name):
|
||||
return "this is not an int"
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ def test_customized_python_discovery(testdir):
|
|||
p = testdir.makepyfile("""
|
||||
def check_simple():
|
||||
pass
|
||||
class CheckMyApp:
|
||||
class CheckMyApp(object):
|
||||
def check_meth(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -1139,7 +1139,7 @@ def test_customize_through_attributes(testdir):
|
|||
return MyClass(name, parent=collector)
|
||||
""")
|
||||
testdir.makepyfile("""
|
||||
class MyTestClass:
|
||||
class MyTestClass(object):
|
||||
def test_hello(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -1153,11 +1153,11 @@ def test_customize_through_attributes(testdir):
|
|||
|
||||
def test_unorderable_types(testdir):
|
||||
testdir.makepyfile("""
|
||||
class TestJoinEmpty:
|
||||
class TestJoinEmpty(object):
|
||||
pass
|
||||
|
||||
def make_test():
|
||||
class Test:
|
||||
class Test(object):
|
||||
pass
|
||||
Test.__name__ = "TestFoo"
|
||||
return Test
|
||||
|
|
|
@ -20,7 +20,7 @@ def test_getfuncargnames():
|
|||
def h(arg1, arg2, arg3="hello"): pass
|
||||
assert fixtures.getfuncargnames(h) == ('arg1', 'arg2')
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
def f(self, arg1, arg2="hello"):
|
||||
pass
|
||||
|
||||
|
@ -28,7 +28,7 @@ def test_getfuncargnames():
|
|||
if sys.version_info < (3,0):
|
||||
assert fixtures.getfuncargnames(A.f) == ('arg1',)
|
||||
|
||||
class TestFillFixtures:
|
||||
class TestFillFixtures(object):
|
||||
def test_fillfuncargs_exposed(self):
|
||||
# used by oejskit, kept for compatibility
|
||||
assert pytest._fillfuncargs == fixtures.fillfixtures
|
||||
|
@ -79,7 +79,7 @@ class TestFillFixtures:
|
|||
def something(request):
|
||||
return request.function.__name__
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self, something):
|
||||
assert something == "test_method"
|
||||
def test_func(something):
|
||||
|
@ -91,7 +91,7 @@ class TestFillFixtures:
|
|||
def test_funcarg_lookup_classlevel(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
|
||||
@pytest.fixture
|
||||
def something(self, request):
|
||||
|
@ -134,7 +134,7 @@ class TestFillFixtures:
|
|||
def spam():
|
||||
return 'spam'
|
||||
|
||||
class TestSpam:
|
||||
class TestSpam(object):
|
||||
|
||||
@pytest.fixture
|
||||
def spam(self, spam):
|
||||
|
@ -463,7 +463,7 @@ class TestFillFixtures:
|
|||
assert result.ret == 0
|
||||
|
||||
|
||||
class TestRequestBasic:
|
||||
class TestRequestBasic(object):
|
||||
def test_request_attributes(self, testdir):
|
||||
item = testdir.getitem("""
|
||||
import pytest
|
||||
|
@ -484,7 +484,7 @@ class TestRequestBasic:
|
|||
def test_request_attributes_method(self, testdir):
|
||||
item, = testdir.getitems("""
|
||||
import pytest
|
||||
class TestB:
|
||||
class TestB(object):
|
||||
|
||||
@pytest.fixture
|
||||
def something(self, request):
|
||||
|
@ -502,7 +502,7 @@ class TestRequestBasic:
|
|||
@pytest.fixture
|
||||
def something(request):
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self, something):
|
||||
pass
|
||||
""")
|
||||
|
@ -704,7 +704,7 @@ class TestRequestBasic:
|
|||
def test_func():
|
||||
pass
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def setup_class(self):
|
||||
l.append("class")
|
||||
|
@ -771,7 +771,7 @@ class TestRequestBasic:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=2)
|
||||
|
||||
class TestRequestMarking:
|
||||
class TestRequestMarking(object):
|
||||
def test_applymarker(self, testdir):
|
||||
item1,item2 = testdir.getitems("""
|
||||
import pytest
|
||||
|
@ -779,7 +779,7 @@ class TestRequestMarking:
|
|||
@pytest.fixture
|
||||
def something(request):
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_func1(self, something):
|
||||
pass
|
||||
def test_func2(self, something):
|
||||
|
@ -831,7 +831,7 @@ class TestRequestMarking:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=2)
|
||||
|
||||
class TestRequestCachedSetup:
|
||||
class TestRequestCachedSetup(object):
|
||||
def test_request_cachedsetup_defaultmodule(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
mysetup = ["hello",].pop
|
||||
|
@ -844,7 +844,7 @@ class TestRequestCachedSetup:
|
|||
|
||||
def test_func1(something):
|
||||
assert something == "hello"
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_func1a(self, something):
|
||||
assert something == "hello"
|
||||
""")
|
||||
|
@ -862,7 +862,7 @@ class TestRequestCachedSetup:
|
|||
assert something == "hello3"
|
||||
def test_func2(something):
|
||||
assert something == "hello2"
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_func1a(self, something):
|
||||
assert something == "hello"
|
||||
def test_func2b(self, something):
|
||||
|
@ -996,7 +996,7 @@ class TestRequestCachedSetup:
|
|||
"*ZeroDivisionError*",
|
||||
])
|
||||
|
||||
class TestFixtureUsages:
|
||||
class TestFixtureUsages(object):
|
||||
def test_noargfixturedec(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -1138,7 +1138,7 @@ class TestFixtureUsages:
|
|||
def test_factory_setup_as_classes_fails(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
class arg1:
|
||||
class arg1(object):
|
||||
def __init__(self, request):
|
||||
self.x = 1
|
||||
arg1 = pytest.fixture()(arg1)
|
||||
|
@ -1172,7 +1172,7 @@ class TestFixtureUsages:
|
|||
request.cls.hello = "world"
|
||||
l.append(1)
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_one(self):
|
||||
assert self.hello == "world"
|
||||
assert len(l) == 1
|
||||
|
@ -1198,7 +1198,7 @@ class TestFixtureUsages:
|
|||
|
||||
""")
|
||||
testdir.makepyfile("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_one(self):
|
||||
assert self.hello == "world"
|
||||
def test_two(self):
|
||||
|
@ -1217,7 +1217,7 @@ class TestFixtureUsages:
|
|||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.fixture
|
||||
def setup1(self, request):
|
||||
assert self == request.instance
|
||||
|
@ -1256,7 +1256,7 @@ class TestFixtureUsages:
|
|||
assert l == [1,2, 10,20]
|
||||
|
||||
|
||||
class TestFixtureManagerParseFactories:
|
||||
class TestFixtureManagerParseFactories(object):
|
||||
|
||||
@pytest.fixture
|
||||
def testdir(self, request):
|
||||
|
@ -1280,7 +1280,7 @@ class TestFixtureManagerParseFactories:
|
|||
|
||||
def test_parsefactories_evil_objects_issue214(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
class A:
|
||||
class A(object):
|
||||
def __call__(self):
|
||||
pass
|
||||
def __getattr__(self, name):
|
||||
|
@ -1311,7 +1311,7 @@ class TestFixtureManagerParseFactories:
|
|||
@pytest.fixture
|
||||
def hello(request):
|
||||
return "module"
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.fixture
|
||||
def hello(self, request):
|
||||
return "class"
|
||||
|
@ -1360,7 +1360,7 @@ class TestFixtureManagerParseFactories:
|
|||
reprec.assertoutcome(passed=2)
|
||||
|
||||
|
||||
class TestAutouseDiscovery:
|
||||
class TestAutouseDiscovery(object):
|
||||
|
||||
@pytest.fixture
|
||||
def testdir(self, testdir):
|
||||
|
@ -1402,14 +1402,14 @@ class TestAutouseDiscovery:
|
|||
def test_two_classes_separated_autouse(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
class TestA:
|
||||
class TestA(object):
|
||||
l = []
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup1(self):
|
||||
self.l.append(1)
|
||||
def test_setup1(self):
|
||||
assert self.l == [1]
|
||||
class TestB:
|
||||
class TestB(object):
|
||||
l = []
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup2(self):
|
||||
|
@ -1423,7 +1423,7 @@ class TestAutouseDiscovery:
|
|||
def test_setup_at_classlevel(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.fixture(autouse=True)
|
||||
def permethod(self, request):
|
||||
request.instance.funcname = request.function.__name__
|
||||
|
@ -1505,13 +1505,13 @@ class TestAutouseDiscovery:
|
|||
def test_x():
|
||||
assert l == ["module"]
|
||||
|
||||
class TestA:
|
||||
class TestA(object):
|
||||
@pytest.fixture(autouse=True)
|
||||
def append2(self):
|
||||
l.append("A")
|
||||
def test_hello(self):
|
||||
assert l == ["module", "module", "A"], l
|
||||
class TestA2:
|
||||
class TestA2(object):
|
||||
def test_world(self):
|
||||
assert l == ["module", "module", "A", "module"], l
|
||||
""")
|
||||
|
@ -1519,7 +1519,7 @@ class TestAutouseDiscovery:
|
|||
reprec.assertoutcome(passed=3)
|
||||
|
||||
|
||||
class TestAutouseManagement:
|
||||
class TestAutouseManagement(object):
|
||||
def test_autouse_conftest_mid_directory(self, testdir):
|
||||
pkgdir = testdir.mkpydir("xyz123")
|
||||
pkgdir.join("conftest.py").write(_pytest._code.Source("""
|
||||
|
@ -1654,10 +1654,10 @@ class TestAutouseManagement:
|
|||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_1(self):
|
||||
pass
|
||||
class TestClass2:
|
||||
class TestClass2(object):
|
||||
def test_2(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -1682,7 +1682,7 @@ class TestAutouseManagement:
|
|||
def mappend():
|
||||
l.append(1)
|
||||
|
||||
class TestHallo:
|
||||
class TestHallo(object):
|
||||
def test_method(self):
|
||||
assert l == [1,3,2]
|
||||
""")
|
||||
|
@ -1696,7 +1696,7 @@ class TestAutouseManagement:
|
|||
def pytest_generate_tests(metafunc):
|
||||
if metafunc.cls is not None:
|
||||
metafunc.parametrize("item", [1,2], scope="class")
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def addteardown(self, item, request):
|
||||
l.append("setup-%d" % item)
|
||||
|
@ -1756,7 +1756,7 @@ class TestAutouseManagement:
|
|||
reprec.assertoutcome(passed=2)
|
||||
|
||||
|
||||
class TestFixtureMarker:
|
||||
class TestFixtureMarker(object):
|
||||
def test_parametrize(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -1822,7 +1822,7 @@ class TestFixtureMarker:
|
|||
def test_2(arg):
|
||||
assert arg == 1
|
||||
assert len(l) == 1
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test3(self, arg):
|
||||
assert arg == 1
|
||||
assert len(l) == 1
|
||||
|
@ -1916,7 +1916,7 @@ class TestFixtureMarker:
|
|||
def test_2(arg):
|
||||
assert arg == 1
|
||||
assert len(l) == 1
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test3(self, arg):
|
||||
assert arg == 1
|
||||
assert len(l) == 1
|
||||
|
@ -2135,12 +2135,12 @@ class TestFixtureMarker:
|
|||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
class TestClass2:
|
||||
class TestClass2(object):
|
||||
def test_1(self):
|
||||
pass
|
||||
def test_2(self):
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_3(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -2213,7 +2213,7 @@ class TestFixtureMarker:
|
|||
|
||||
l = []
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@classmethod
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def setup1(self, request, param1):
|
||||
|
@ -2273,7 +2273,7 @@ class TestFixtureMarker:
|
|||
testpath = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
class Box:
|
||||
class Box(object):
|
||||
value = 0
|
||||
|
||||
@pytest.fixture(scope='class')
|
||||
|
@ -2284,11 +2284,11 @@ class TestFixtureMarker:
|
|||
def test_a(a):
|
||||
assert a == 1
|
||||
|
||||
class Test1:
|
||||
class Test1(object):
|
||||
def test_b(self, a):
|
||||
assert a == 2
|
||||
|
||||
class Test2:
|
||||
class Test2(object):
|
||||
def test_c(self, a):
|
||||
assert a == 3""")
|
||||
reprec = testdir.inline_run(testpath)
|
||||
|
@ -2402,11 +2402,11 @@ class TestFixtureMarker:
|
|||
request.addfinalizer(lambda: l.append("fin %s" % request.param))
|
||||
return request.param
|
||||
|
||||
class TestGreetings:
|
||||
class TestGreetings(object):
|
||||
def test_hello(self, human):
|
||||
l.append("test_hello")
|
||||
|
||||
class TestMetrics:
|
||||
class TestMetrics(object):
|
||||
def test_name(self, human):
|
||||
l.append("test_name")
|
||||
|
||||
|
@ -2499,7 +2499,7 @@ class TestFixtureMarker:
|
|||
'*test_foo*beta*'])
|
||||
|
||||
|
||||
class TestRequestScopeAccess:
|
||||
class TestRequestScopeAccess(object):
|
||||
pytestmark = pytest.mark.parametrize(("scope", "ok", "error"),[
|
||||
["session", "", "fspath class function module"],
|
||||
["module", "module fspath", "cls function"],
|
||||
|
@ -2543,7 +2543,7 @@ class TestRequestScopeAccess:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
class TestErrors:
|
||||
class TestErrors(object):
|
||||
def test_subfactory_missing_funcarg(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -2607,7 +2607,7 @@ class TestErrors:
|
|||
"*1 error*",
|
||||
])
|
||||
|
||||
class TestShowFixtures:
|
||||
class TestShowFixtures(object):
|
||||
def test_funcarg_compat(self, testdir):
|
||||
config = testdir.parseconfigure("--funcargs")
|
||||
assert config.option.showfixtures
|
||||
|
@ -2770,7 +2770,7 @@ class TestShowFixtures:
|
|||
|
||||
|
||||
@pytest.mark.parametrize('flavor', ['fixture', 'yield_fixture'])
|
||||
class TestContextManagerFixtureFuncs:
|
||||
class TestContextManagerFixtureFuncs(object):
|
||||
|
||||
def test_simple(self, testdir, flavor):
|
||||
testdir.makepyfile("""
|
||||
|
@ -2877,7 +2877,7 @@ class TestContextManagerFixtureFuncs:
|
|||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("*mew*")
|
||||
|
||||
class TestParameterizedSubRequest:
|
||||
class TestParameterizedSubRequest(object):
|
||||
def test_call_from_fixture(self, testdir):
|
||||
testfile = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
|
|
@ -3,7 +3,7 @@ from _pytest import python
|
|||
from _pytest import runner
|
||||
|
||||
|
||||
class TestOEJSKITSpecials:
|
||||
class TestOEJSKITSpecials(object):
|
||||
def test_funcarg_non_pycollectobj(self, testdir): # rough jstests usage
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
@ -19,7 +19,7 @@ class TestOEJSKITSpecials:
|
|||
@pytest.fixture
|
||||
def arg1(request):
|
||||
return 42
|
||||
class MyClass:
|
||||
class MyClass(object):
|
||||
pass
|
||||
""")
|
||||
# this hook finds funcarg factories
|
||||
|
@ -48,7 +48,7 @@ class TestOEJSKITSpecials:
|
|||
@pytest.fixture
|
||||
def arg1(request):
|
||||
return 42
|
||||
class MyClass:
|
||||
class MyClass(object):
|
||||
pass
|
||||
""")
|
||||
# this hook finds funcarg factories
|
||||
|
@ -76,7 +76,7 @@ def test_wrapped_getfslineno():
|
|||
fs2, lineno2 = python.getfslineno(wrap)
|
||||
assert lineno > lineno2, "getfslineno does not unwrap correctly"
|
||||
|
||||
class TestMockDecoration:
|
||||
class TestMockDecoration(object):
|
||||
def test_wrapped_getfuncargnames(self):
|
||||
from _pytest.compat import getfuncargnames
|
||||
|
||||
|
@ -207,7 +207,7 @@ class TestMockDecoration:
|
|||
@patch('os.getcwd')
|
||||
@patch('os.path')
|
||||
@mark.slow
|
||||
class TestSimple:
|
||||
class TestSimple(object):
|
||||
def test_simple_thing(self, mock_path, mock_getcwd):
|
||||
pass
|
||||
""")
|
||||
|
@ -215,7 +215,7 @@ class TestMockDecoration:
|
|||
reprec.assertoutcome(passed=1)
|
||||
|
||||
|
||||
class TestReRunTests:
|
||||
class TestReRunTests(object):
|
||||
def test_rerun(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
from _pytest.runner import runtestprotocol
|
||||
|
@ -251,7 +251,7 @@ def test_pytestconfig_is_session_scoped():
|
|||
assert pytestconfig._pytestfixturefunction.scope == "session"
|
||||
|
||||
|
||||
class TestNoselikeTestAttribute:
|
||||
class TestNoselikeTestAttribute(object):
|
||||
def test_module_with_global_test(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
__test__ = False
|
||||
|
@ -270,7 +270,7 @@ class TestNoselikeTestAttribute:
|
|||
pass
|
||||
test_func.__test__ = False
|
||||
|
||||
class TestSome:
|
||||
class TestSome(object):
|
||||
__test__ = False
|
||||
def test_method(self):
|
||||
pass
|
||||
|
@ -328,7 +328,7 @@ class TestNoselikeTestAttribute:
|
|||
|
||||
|
||||
@pytest.mark.issue351
|
||||
class TestParameterize:
|
||||
class TestParameterize(object):
|
||||
|
||||
def test_idfn_marker(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
|
|
|
@ -13,12 +13,12 @@ from hypothesis import strategies
|
|||
PY3 = sys.version_info >= (3, 0)
|
||||
|
||||
|
||||
class TestMetafunc:
|
||||
class TestMetafunc(object):
|
||||
def Metafunc(self, func):
|
||||
# the unit tests of this class check if things work correctly
|
||||
# on the funcarg level, so we don't need a full blown
|
||||
# initiliazation
|
||||
class FixtureInfo:
|
||||
class FixtureInfo(object):
|
||||
name2fixturedefs = None
|
||||
|
||||
def __init__(self, names):
|
||||
|
@ -68,7 +68,7 @@ class TestMetafunc:
|
|||
def func(arg1): pass
|
||||
metafunc = self.Metafunc(func)
|
||||
|
||||
class obj: pass
|
||||
class obj(object): pass
|
||||
|
||||
metafunc.addcall(param=obj)
|
||||
metafunc.addcall(param=obj)
|
||||
|
@ -83,7 +83,7 @@ class TestMetafunc:
|
|||
|
||||
metafunc = self.Metafunc(func)
|
||||
|
||||
class obj: pass
|
||||
class obj(object): pass
|
||||
|
||||
metafunc.addcall(funcargs={"x": 2})
|
||||
metafunc.addcall(funcargs={"x": 3})
|
||||
|
@ -150,7 +150,7 @@ class TestMetafunc:
|
|||
def func(x, y): pass
|
||||
metafunc = self.Metafunc(func)
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
pass
|
||||
|
||||
metafunc.parametrize("x", [A(), A()])
|
||||
|
@ -601,7 +601,7 @@ class TestMetafunc:
|
|||
pytestmark = pytest.mark.parametrize("x", [1,2])
|
||||
def test_func(x):
|
||||
assert 0, x
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = pytest.mark.parametrize("y", [3,4])
|
||||
def test_meth(self, x, y):
|
||||
assert 0, x
|
||||
|
@ -672,7 +672,7 @@ class TestMetafunc:
|
|||
assert fixtures._format_args(function4) == "(arg1, *args, **kwargs)"
|
||||
|
||||
|
||||
class TestMetafuncFunctional:
|
||||
class TestMetafuncFunctional(object):
|
||||
def test_attributes(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
# assumes that generate/provide runs in the same process
|
||||
|
@ -691,7 +691,7 @@ class TestMetafuncFunctional:
|
|||
assert metafunc.function == test_function
|
||||
assert metafunc.cls is None
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self, metafunc, pytestconfig):
|
||||
assert metafunc.config == pytestconfig
|
||||
assert metafunc.module.__name__ == __name__
|
||||
|
@ -716,7 +716,7 @@ class TestMetafuncFunctional:
|
|||
def pytest_generate_tests(metafunc):
|
||||
metafunc.addcall(funcargs=dict(arg1=1, arg2=1))
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_myfunc(self, arg1, arg2):
|
||||
assert arg1 == arg2
|
||||
""")
|
||||
|
@ -756,7 +756,7 @@ class TestMetafuncFunctional:
|
|||
def pytest_generate_tests(metafunc):
|
||||
assert 'xyz' not in metafunc.fixturenames
|
||||
|
||||
class TestHello:
|
||||
class TestHello(object):
|
||||
def test_hello(xyz):
|
||||
pass
|
||||
""")
|
||||
|
@ -782,7 +782,7 @@ class TestMetafuncFunctional:
|
|||
def arg2(request):
|
||||
return request.param[1]
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_myfunc(self, arg1, arg2):
|
||||
assert arg1 == arg2
|
||||
""")
|
||||
|
@ -795,7 +795,7 @@ class TestMetafuncFunctional:
|
|||
|
||||
def test_generate_tests_in_class(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def pytest_generate_tests(self, metafunc):
|
||||
metafunc.addcall(funcargs={'hello': 'world'}, id="hello")
|
||||
|
||||
|
@ -814,7 +814,7 @@ class TestMetafuncFunctional:
|
|||
metafunc.addcall({'arg1': 10})
|
||||
metafunc.addcall({'arg1': 20})
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_func(self, arg1):
|
||||
assert not hasattr(self, 'x')
|
||||
self.x = 1
|
||||
|
@ -831,7 +831,7 @@ class TestMetafuncFunctional:
|
|||
def pytest_generate_tests(metafunc):
|
||||
metafunc.addcall({'arg1': 1})
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self, arg1):
|
||||
assert arg1 == self.val
|
||||
def setup_method(self, func):
|
||||
|
@ -1117,7 +1117,7 @@ class TestMetafuncFunctional:
|
|||
assert expectederror in failures[0].longrepr.reprcrash.message
|
||||
|
||||
|
||||
class TestMetafuncFunctionalAuto:
|
||||
class TestMetafuncFunctionalAuto(object):
|
||||
"""
|
||||
Tests related to automatically find out the correct scope for parametrized tests (#1832).
|
||||
"""
|
||||
|
@ -1236,7 +1236,7 @@ class TestMetafuncFunctionalAuto:
|
|||
assert output.count('preparing foo-3') == 1
|
||||
|
||||
|
||||
class TestMarkersWithParametrization:
|
||||
class TestMarkersWithParametrization(object):
|
||||
pytestmark = pytest.mark.issue308
|
||||
def test_simple_mark(self, testdir):
|
||||
s = """
|
||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
|||
import sys
|
||||
|
||||
|
||||
class TestRaises:
|
||||
class TestRaises(object):
|
||||
def test_raises(self):
|
||||
source = "int('qwe')"
|
||||
excinfo = pytest.raises(ValueError, source)
|
||||
|
@ -20,7 +20,7 @@ class TestRaises:
|
|||
pytest.raises(ValueError, int, 'hello')
|
||||
|
||||
def test_raises_callable_no_exception(self):
|
||||
class A:
|
||||
class A(object):
|
||||
def __call__(self):
|
||||
pass
|
||||
try:
|
||||
|
|
|
@ -69,7 +69,7 @@ class FilesCompleter(object):
|
|||
completion += [f + '/' for f in anticomp]
|
||||
return completion
|
||||
|
||||
class TestArgComplete:
|
||||
class TestArgComplete(object):
|
||||
@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
|
||||
def test_compare_with_compgen(self):
|
||||
from _pytest._argcomplete import FastFilesCompleter
|
||||
|
|
|
@ -25,7 +25,7 @@ def mock_config():
|
|||
return Config()
|
||||
|
||||
|
||||
class TestImportHookInstallation:
|
||||
class TestImportHookInstallation(object):
|
||||
|
||||
@pytest.mark.parametrize('initial_conftest', [True, False])
|
||||
@pytest.mark.parametrize('mode', ['plain', 'rewrite'])
|
||||
|
@ -159,7 +159,7 @@ class TestImportHookInstallation:
|
|||
|
||||
plugin_state = "{plugin_state}"
|
||||
|
||||
class DummyDistInfo:
|
||||
class DummyDistInfo(object):
|
||||
project_name = 'spam'
|
||||
version = '1.0'
|
||||
|
||||
|
@ -174,7 +174,7 @@ class TestImportHookInstallation:
|
|||
'hampkg/__init__.py']
|
||||
return []
|
||||
|
||||
class DummyEntryPoint:
|
||||
class DummyEntryPoint(object):
|
||||
name = 'spam'
|
||||
module_name = 'spam.py'
|
||||
attrs = ()
|
||||
|
@ -257,7 +257,7 @@ class TestImportHookInstallation:
|
|||
'pytest_tests_internal_non_existing2')
|
||||
|
||||
|
||||
class TestBinReprIntegration:
|
||||
class TestBinReprIntegration(object):
|
||||
|
||||
def test_pytest_assertrepr_compare_called(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
|
@ -288,7 +288,7 @@ def callequal(left, right, verbose=False):
|
|||
return plugin.pytest_assertrepr_compare(config, '==', left, right)
|
||||
|
||||
|
||||
class TestAssert_reprcompare:
|
||||
class TestAssert_reprcompare(object):
|
||||
def test_different_types(self):
|
||||
assert callequal([0, 1], 'foo') is None
|
||||
|
||||
|
@ -442,7 +442,7 @@ class TestAssert_reprcompare:
|
|||
assert len(expl) > 1
|
||||
|
||||
def test_list_bad_repr(self):
|
||||
class A:
|
||||
class A(object):
|
||||
def __repr__(self):
|
||||
raise ValueError(42)
|
||||
expl = callequal([], [A()])
|
||||
|
@ -501,7 +501,7 @@ class TestAssert_reprcompare:
|
|||
assert msg
|
||||
|
||||
|
||||
class TestFormatExplanation:
|
||||
class TestFormatExplanation(object):
|
||||
|
||||
def test_special_chars_full(self, testdir):
|
||||
# Issue 453, for the bug this would raise IndexError
|
||||
|
@ -593,7 +593,7 @@ class TestFormatExplanation:
|
|||
assert util.format_explanation(expl) == res
|
||||
|
||||
|
||||
class TestTruncateExplanation:
|
||||
class TestTruncateExplanation(object):
|
||||
|
||||
""" Confirm assertion output is truncated as expected """
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ def getmsg(f, extra_ns=None, must_pass=False):
|
|||
pytest.fail("function didn't raise at all")
|
||||
|
||||
|
||||
class TestAssertionRewrite:
|
||||
class TestAssertionRewrite(object):
|
||||
|
||||
def test_place_initial_imports(self):
|
||||
s = """'Doc string'\nother = stuff"""
|
||||
|
@ -333,7 +333,7 @@ class TestAssertionRewrite:
|
|||
@pytest.mark.skipif("sys.version_info < (3,5)")
|
||||
def test_at_operator_issue1290(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
class Matrix:
|
||||
class Matrix(object):
|
||||
def __init__(self, num):
|
||||
self.num = num
|
||||
def __matmul__(self, other):
|
||||
|
@ -515,7 +515,7 @@ class TestAssertionRewrite:
|
|||
assert r"where 1 = \n{ \n~ \n}.a" in util._format_lines([getmsg(f)])[0]
|
||||
|
||||
|
||||
class TestRewriteOnImport:
|
||||
class TestRewriteOnImport(object):
|
||||
|
||||
def test_pycache_is_a_file(self, testdir):
|
||||
testdir.tmpdir.join("__pycache__").write("Hello")
|
||||
|
@ -884,7 +884,7 @@ class TestAssertionRewriteHookDetails(object):
|
|||
"""
|
||||
path = testdir.mkpydir("foo")
|
||||
path.join("test_foo.py").write(_pytest._code.Source("""
|
||||
class Test:
|
||||
class Test(object):
|
||||
def test_foo(self):
|
||||
import pkgutil
|
||||
data = pkgutil.get_data('foo.test_foo', 'data.txt')
|
||||
|
@ -912,7 +912,7 @@ def test_issue731(testdir):
|
|||
assert 'unbalanced braces' not in result.stdout.str()
|
||||
|
||||
|
||||
class TestIssue925():
|
||||
class TestIssue925(object):
|
||||
def test_simple_case(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
def test_ternary_display():
|
||||
|
|
|
@ -7,7 +7,7 @@ import shutil
|
|||
|
||||
pytest_plugins = "pytester",
|
||||
|
||||
class TestNewAPI:
|
||||
class TestNewAPI(object):
|
||||
def test_config_cache_makedir(self, testdir):
|
||||
testdir.makeini("[pytest]")
|
||||
config = testdir.parseconfigure()
|
||||
|
@ -129,7 +129,7 @@ def test_cache_show(testdir):
|
|||
])
|
||||
|
||||
|
||||
class TestLastFailed:
|
||||
class TestLastFailed(object):
|
||||
|
||||
def test_lastfailed_usecase(self, testdir, monkeypatch):
|
||||
monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
|
||||
|
|
|
@ -55,7 +55,7 @@ def StdCapture(out=True, err=True, in_=True):
|
|||
return capture.MultiCapture(out, err, in_, Capture=capture.SysCapture)
|
||||
|
||||
|
||||
class TestCaptureManager:
|
||||
class TestCaptureManager(object):
|
||||
def test_getmethod_default_no_fd(self, monkeypatch):
|
||||
from _pytest.capture import pytest_addoption
|
||||
from _pytest.config import Parser
|
||||
|
@ -154,7 +154,7 @@ def test_collect_capturing(testdir):
|
|||
])
|
||||
|
||||
|
||||
class TestPerTestCapturing:
|
||||
class TestPerTestCapturing(object):
|
||||
def test_capture_and_fixtures(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
def setup_module(mod):
|
||||
|
@ -275,7 +275,7 @@ class TestPerTestCapturing:
|
|||
])
|
||||
|
||||
|
||||
class TestLoggingInteraction:
|
||||
class TestLoggingInteraction(object):
|
||||
def test_logging_stream_ownership(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
def test_logging():
|
||||
|
@ -395,7 +395,7 @@ class TestLoggingInteraction:
|
|||
assert 'operation on closed file' not in result.stderr.str()
|
||||
|
||||
|
||||
class TestCaptureFixture:
|
||||
class TestCaptureFixture(object):
|
||||
@pytest.mark.parametrize("opt", [[], ["-s"]])
|
||||
def test_std_functional(self, testdir, opt):
|
||||
reprec = testdir.inline_runsource("""
|
||||
|
@ -622,7 +622,7 @@ def test_error_during_readouterr(testdir):
|
|||
])
|
||||
|
||||
|
||||
class TestTextIO:
|
||||
class TestTextIO(object):
|
||||
def test_text(self):
|
||||
f = capture.TextIO()
|
||||
f.write("hello")
|
||||
|
@ -737,7 +737,7 @@ def lsof_check():
|
|||
assert len2 < len1 + 3, out2
|
||||
|
||||
|
||||
class TestFDCapture:
|
||||
class TestFDCapture(object):
|
||||
pytestmark = needsosdup
|
||||
|
||||
def test_simple(self, tmpfile):
|
||||
|
@ -832,7 +832,7 @@ def saved_fd(fd):
|
|||
os.close(new_fd)
|
||||
|
||||
|
||||
class TestStdCapture:
|
||||
class TestStdCapture(object):
|
||||
captureclass = staticmethod(StdCapture)
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
@ -990,7 +990,7 @@ class TestStdCaptureFD(TestStdCapture):
|
|||
cap.stop_capturing()
|
||||
|
||||
|
||||
class TestStdCaptureFDinvalidFD:
|
||||
class TestStdCaptureFDinvalidFD(object):
|
||||
pytestmark = needsosdup
|
||||
|
||||
def test_stdcapture_fd_invalid_fd(self, testdir):
|
||||
|
|
|
@ -2,7 +2,7 @@ import pytest, py
|
|||
|
||||
from _pytest.main import Session, EXIT_NOTESTSCOLLECTED
|
||||
|
||||
class TestCollector:
|
||||
class TestCollector(object):
|
||||
def test_collect_versus_item(self):
|
||||
from pytest import Collector, Item
|
||||
assert not issubclass(Collector, Item)
|
||||
|
@ -50,7 +50,7 @@ class TestCollector:
|
|||
|
||||
def test_getparent(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_foo():
|
||||
pass
|
||||
""")
|
||||
|
@ -88,7 +88,7 @@ class TestCollector:
|
|||
def test_can_skip_class_with_test_attr(self, testdir):
|
||||
"""Assure test class is skipped when using `__test__=False` (See #2007)."""
|
||||
testdir.makepyfile("""
|
||||
class TestFoo():
|
||||
class TestFoo(object):
|
||||
__test__ = False
|
||||
def __init__(self):
|
||||
pass
|
||||
|
@ -101,7 +101,7 @@ class TestCollector:
|
|||
'*no tests ran in*',
|
||||
])
|
||||
|
||||
class TestCollectFS:
|
||||
class TestCollectFS(object):
|
||||
def test_ignored_certain_directories(self, testdir):
|
||||
tmpdir = testdir.tmpdir
|
||||
tmpdir.ensure("build", 'test_notfound.py')
|
||||
|
@ -163,11 +163,11 @@ class TestCollectFS:
|
|||
assert [x.name for x in items] == ['test_%s' % dirname]
|
||||
|
||||
|
||||
class TestCollectPluginHookRelay:
|
||||
class TestCollectPluginHookRelay(object):
|
||||
def test_pytest_collect_file(self, testdir):
|
||||
wascalled = []
|
||||
|
||||
class Plugin:
|
||||
class Plugin(object):
|
||||
def pytest_collect_file(self, path, parent):
|
||||
if not path.basename.startswith("."):
|
||||
# Ignore hidden files, e.g. .testmondata.
|
||||
|
@ -181,7 +181,7 @@ class TestCollectPluginHookRelay:
|
|||
def test_pytest_collect_directory(self, testdir):
|
||||
wascalled = []
|
||||
|
||||
class Plugin:
|
||||
class Plugin(object):
|
||||
def pytest_collect_directory(self, path, parent):
|
||||
wascalled.append(path.basename)
|
||||
|
||||
|
@ -192,7 +192,7 @@ class TestCollectPluginHookRelay:
|
|||
assert "world" in wascalled
|
||||
|
||||
|
||||
class TestPrunetraceback:
|
||||
class TestPrunetraceback(object):
|
||||
|
||||
def test_custom_repr_failure(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
|
@ -238,7 +238,7 @@ class TestPrunetraceback:
|
|||
])
|
||||
|
||||
|
||||
class TestCustomConftests:
|
||||
class TestCustomConftests(object):
|
||||
def test_ignore_collect_path(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
def pytest_ignore_collect(path, config):
|
||||
|
@ -333,7 +333,7 @@ class TestCustomConftests:
|
|||
"*test_x*"
|
||||
])
|
||||
|
||||
class TestSession:
|
||||
class TestSession(object):
|
||||
def test_parsearg(self, testdir):
|
||||
p = testdir.makepyfile("def test_func(): pass")
|
||||
subdir = testdir.mkdir("sub")
|
||||
|
@ -391,7 +391,7 @@ class TestSession:
|
|||
|
||||
def test_collect_protocol_method(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -490,7 +490,7 @@ class TestSession:
|
|||
|
||||
def test_find_byid_without_instance_parents(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -500,7 +500,7 @@ class TestSession:
|
|||
item, = items
|
||||
assert item.nodeid.endswith("TestClass::()::test_method")
|
||||
|
||||
class Test_getinitialnodes:
|
||||
class Test_getinitialnodes(object):
|
||||
def test_global_file(self, testdir, tmpdir):
|
||||
x = tmpdir.ensure("x.py")
|
||||
with tmpdir.as_cwd():
|
||||
|
@ -527,7 +527,7 @@ class Test_getinitialnodes:
|
|||
for col in col.listchain():
|
||||
assert col.config is config
|
||||
|
||||
class Test_genitems:
|
||||
class Test_genitems(object):
|
||||
def test_check_collect_hashes(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
def test_1():
|
||||
|
@ -550,7 +550,7 @@ class Test_genitems:
|
|||
def testone():
|
||||
pass
|
||||
|
||||
class TestX:
|
||||
class TestX(object):
|
||||
def testmethod_one(self):
|
||||
pass
|
||||
|
||||
|
@ -583,11 +583,11 @@ class Test_genitems:
|
|||
python_functions = *_test test
|
||||
""")
|
||||
p = testdir.makepyfile('''
|
||||
class MyTestSuite:
|
||||
class MyTestSuite(object):
|
||||
def x_test(self):
|
||||
pass
|
||||
|
||||
class TestCase:
|
||||
class TestCase(object):
|
||||
def test_y(self):
|
||||
pass
|
||||
''')
|
||||
|
@ -602,7 +602,7 @@ def test_matchnodes_two_collections_same_file(testdir):
|
|||
def pytest_configure(config):
|
||||
config.pluginmanager.register(Plugin2())
|
||||
|
||||
class Plugin2:
|
||||
class Plugin2(object):
|
||||
def pytest_collect_file(self, path, parent):
|
||||
if path.ext == ".abc":
|
||||
return MyFile2(path, parent)
|
||||
|
@ -634,7 +634,7 @@ def test_matchnodes_two_collections_same_file(testdir):
|
|||
])
|
||||
|
||||
|
||||
class TestNodekeywords:
|
||||
class TestNodekeywords(object):
|
||||
def test_no_under(self, testdir):
|
||||
modcol = testdir.getmodulecol("""
|
||||
def test_pass(): pass
|
||||
|
|
|
@ -4,7 +4,7 @@ import _pytest._code
|
|||
from _pytest.config import getcfg, get_common_ancestor, determine_setup
|
||||
from _pytest.main import EXIT_NOTESTSCOLLECTED
|
||||
|
||||
class TestParseIni:
|
||||
class TestParseIni(object):
|
||||
|
||||
@pytest.mark.parametrize('section, filename',
|
||||
[('pytest', 'pytest.ini'), ('tool:pytest', 'setup.cfg')])
|
||||
|
@ -84,7 +84,7 @@ class TestParseIni:
|
|||
result = testdir.inline_run("--confcutdir=.")
|
||||
assert result.ret == 0
|
||||
|
||||
class TestConfigCmdlineParsing:
|
||||
class TestConfigCmdlineParsing(object):
|
||||
def test_parsing_again_fails(self, testdir):
|
||||
config = testdir.parseconfig()
|
||||
pytest.raises(AssertionError, lambda: config.parse([]))
|
||||
|
@ -115,7 +115,7 @@ class TestConfigCmdlineParsing:
|
|||
ret = pytest.main("-c " + temp_cfg_file)
|
||||
assert ret == _pytest.main.EXIT_OK
|
||||
|
||||
class TestConfigAPI:
|
||||
class TestConfigAPI(object):
|
||||
def test_config_trace(self, testdir):
|
||||
config = testdir.parseconfig()
|
||||
l = []
|
||||
|
@ -304,7 +304,7 @@ class TestConfigAPI:
|
|||
assert config.getoption('confcutdir') == str(testdir.tmpdir.join('dir'))
|
||||
|
||||
|
||||
class TestConfigFromdictargs:
|
||||
class TestConfigFromdictargs(object):
|
||||
def test_basic_behavior(self):
|
||||
from _pytest.config import Config
|
||||
option_dict = {
|
||||
|
@ -389,19 +389,19 @@ def test_preparse_ordering_with_setuptools(testdir, monkeypatch):
|
|||
def my_iter(name):
|
||||
assert name == "pytest11"
|
||||
|
||||
class Dist:
|
||||
class Dist(object):
|
||||
project_name = 'spam'
|
||||
version = '1.0'
|
||||
|
||||
def _get_metadata(self, name):
|
||||
return ['foo.txt,sha256=abc,123']
|
||||
|
||||
class EntryPoint:
|
||||
class EntryPoint(object):
|
||||
name = "mytestplugin"
|
||||
dist = Dist()
|
||||
|
||||
def load(self):
|
||||
class PseudoPlugin:
|
||||
class PseudoPlugin(object):
|
||||
x = 42
|
||||
return PseudoPlugin()
|
||||
|
||||
|
@ -423,14 +423,14 @@ def test_setuptools_importerror_issue1479(testdir, monkeypatch):
|
|||
def my_iter(name):
|
||||
assert name == "pytest11"
|
||||
|
||||
class Dist:
|
||||
class Dist(object):
|
||||
project_name = 'spam'
|
||||
version = '1.0'
|
||||
|
||||
def _get_metadata(self, name):
|
||||
return ['foo.txt,sha256=abc,123']
|
||||
|
||||
class EntryPoint:
|
||||
class EntryPoint(object):
|
||||
name = "mytestplugin"
|
||||
dist = Dist()
|
||||
|
||||
|
@ -450,14 +450,14 @@ def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch):
|
|||
def my_iter(name):
|
||||
assert name == "pytest11"
|
||||
|
||||
class Dist:
|
||||
class Dist(object):
|
||||
project_name = 'spam'
|
||||
version = '1.0'
|
||||
|
||||
def _get_metadata(self, name):
|
||||
return ['foo.txt,sha256=abc,123']
|
||||
|
||||
class EntryPoint:
|
||||
class EntryPoint(object):
|
||||
name = "mytestplugin"
|
||||
dist = Dist()
|
||||
|
||||
|
@ -557,7 +557,7 @@ def test_notify_exception(testdir, capfd):
|
|||
out, err = capfd.readouterr()
|
||||
assert "ValueError" in err
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
def pytest_internalerror(self, excrepr):
|
||||
return True
|
||||
|
||||
|
@ -571,7 +571,7 @@ def test_load_initial_conftest_last_ordering(testdir):
|
|||
from _pytest.config import get_config
|
||||
pm = get_config().pluginmanager
|
||||
|
||||
class My:
|
||||
class My(object):
|
||||
def pytest_load_initial_conftests(self):
|
||||
pass
|
||||
|
||||
|
@ -602,7 +602,7 @@ def test_get_plugin_specs_as_list():
|
|||
assert _get_plugin_specs_as_list(('foo', 'bar')) == ['foo', 'bar']
|
||||
|
||||
|
||||
class TestWarning:
|
||||
class TestWarning(object):
|
||||
def test_warn_config(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
l = []
|
||||
|
@ -641,7 +641,7 @@ class TestWarning:
|
|||
*WT1*test_warn_on_test_item*:7 hello*
|
||||
""")
|
||||
|
||||
class TestRootdir:
|
||||
class TestRootdir(object):
|
||||
def test_simple_noini(self, tmpdir):
|
||||
assert get_common_ancestor([tmpdir]) == tmpdir
|
||||
a = tmpdir.mkdir("a")
|
||||
|
@ -699,7 +699,7 @@ class TestRootdir:
|
|||
assert rootdir == tmpdir
|
||||
|
||||
|
||||
class TestOverrideIniArgs:
|
||||
class TestOverrideIniArgs(object):
|
||||
@pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
|
||||
def test_override_ini_names(self, testdir, name):
|
||||
testdir.tmpdir.join(name).write(py.std.textwrap.dedent("""
|
||||
|
|
|
@ -24,14 +24,14 @@ def ConftestWithSetinitial(path):
|
|||
return conftest
|
||||
|
||||
def conftest_setinitial(conftest, args, confcutdir=None):
|
||||
class Namespace:
|
||||
class Namespace(object):
|
||||
def __init__(self):
|
||||
self.file_or_dir = args
|
||||
self.confcutdir = str(confcutdir)
|
||||
self.noconftest = False
|
||||
conftest._set_initial_conftests(Namespace())
|
||||
|
||||
class TestConftestValueAccessGlobal:
|
||||
class TestConftestValueAccessGlobal(object):
|
||||
def test_basic_init(self, basedir):
|
||||
conftest = PytestPluginManager()
|
||||
p = basedir.join("adir")
|
||||
|
@ -265,7 +265,7 @@ def test_conftest_found_with_double_dash(testdir):
|
|||
""")
|
||||
|
||||
|
||||
class TestConftestVisibility:
|
||||
class TestConftestVisibility(object):
|
||||
def _setup_tree(self, testdir): # for issue616
|
||||
# example mostly taken from:
|
||||
# https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
|
||||
|
@ -398,7 +398,7 @@ def test_search_conftest_up_to_inifile(testdir, confcutdir, passed, error):
|
|||
|
||||
def test_issue1073_conftest_special_objects(testdir):
|
||||
testdir.makeconftest("""
|
||||
class DontTouchMe:
|
||||
class DontTouchMe(object):
|
||||
def __getattr__(self, x):
|
||||
raise Exception('cant touch me')
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile
|
|||
import pytest
|
||||
|
||||
|
||||
class TestDoctests:
|
||||
class TestDoctests(object):
|
||||
|
||||
def test_collect_testtextfile(self, testdir):
|
||||
w = testdir.maketxtfile(whatever="")
|
||||
|
@ -378,7 +378,7 @@ class TestDoctests:
|
|||
|
||||
def test_doctestmodule_two_tests_one_fail(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
class MyClass:
|
||||
class MyClass(object):
|
||||
def bad_meth(self):
|
||||
'''
|
||||
>>> magic = 42
|
||||
|
@ -401,7 +401,7 @@ class TestDoctests:
|
|||
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
|
||||
""")
|
||||
p = testdir.makepyfile("""
|
||||
class MyClass:
|
||||
class MyClass(object):
|
||||
'''
|
||||
>>> a = "foo "
|
||||
>>> print(a)
|
||||
|
@ -418,7 +418,7 @@ class TestDoctests:
|
|||
doctest_optionflags = ELLIPSIS
|
||||
""")
|
||||
p = testdir.makepyfile("""
|
||||
class MyClass:
|
||||
class MyClass(object):
|
||||
'''
|
||||
>>> a = "foo "
|
||||
>>> print(a)
|
||||
|
@ -505,7 +505,7 @@ class TestDoctests:
|
|||
reprec.assertoutcome(failed=1)
|
||||
|
||||
|
||||
class TestLiterals:
|
||||
class TestLiterals(object):
|
||||
|
||||
@pytest.mark.parametrize('config_mode', ['ini', 'comment'])
|
||||
def test_allow_unicode(self, testdir, config_mode):
|
||||
|
@ -592,7 +592,7 @@ class TestLiterals:
|
|||
reprec.assertoutcome(passed=passed, failed=int(not passed))
|
||||
|
||||
|
||||
class TestDoctestSkips:
|
||||
class TestDoctestSkips(object):
|
||||
"""
|
||||
If all examples in a doctest are skipped due to the SKIP option, then
|
||||
the tests should be SKIPPED rather than PASSED. (#957)
|
||||
|
@ -646,7 +646,7 @@ class TestDoctestSkips:
|
|||
reprec.assertoutcome(passed=0, skipped=0)
|
||||
|
||||
|
||||
class TestDoctestAutoUseFixtures:
|
||||
class TestDoctestAutoUseFixtures(object):
|
||||
|
||||
SCOPES = ['module', 'session', 'class', 'function']
|
||||
|
||||
|
@ -765,7 +765,7 @@ class TestDoctestAutoUseFixtures:
|
|||
result.stdout.fnmatch_lines(['*=== 1 passed in *'])
|
||||
|
||||
|
||||
class TestDoctestNamespaceFixture:
|
||||
class TestDoctestNamespaceFixture(object):
|
||||
|
||||
SCOPES = ['module', 'session', 'class', 'function']
|
||||
|
||||
|
@ -815,7 +815,7 @@ class TestDoctestNamespaceFixture:
|
|||
reprec.assertoutcome(passed=1)
|
||||
|
||||
|
||||
class TestDoctestReportingOption:
|
||||
class TestDoctestReportingOption(object):
|
||||
def _run_doctest_report(self, testdir, format):
|
||||
testdir.makepyfile("""
|
||||
def foo():
|
||||
|
|
|
@ -79,7 +79,7 @@ class DomNode(object):
|
|||
return type(self)(self.__node.nextSibling)
|
||||
|
||||
|
||||
class TestPython:
|
||||
class TestPython(object):
|
||||
def test_summing_simple(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -263,7 +263,7 @@ class TestPython:
|
|||
|
||||
def test_classname_instance(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
assert 0
|
||||
""")
|
||||
|
@ -376,7 +376,7 @@ class TestPython:
|
|||
testdir.makepyfile("""
|
||||
def test_func():
|
||||
assert 0
|
||||
class TestHello:
|
||||
class TestHello(object):
|
||||
def test_hello(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -569,7 +569,7 @@ def test_mangle_test_address():
|
|||
def test_dont_configure_on_slaves(tmpdir):
|
||||
gotten = []
|
||||
|
||||
class FakeConfig:
|
||||
class FakeConfig(object):
|
||||
def __init__(self):
|
||||
self.pluginmanager = self
|
||||
self.option = self
|
||||
|
@ -588,7 +588,7 @@ def test_dont_configure_on_slaves(tmpdir):
|
|||
assert len(gotten) == 1
|
||||
|
||||
|
||||
class TestNonPython:
|
||||
class TestNonPython(object):
|
||||
def test_summing_simple(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
@ -750,7 +750,7 @@ def test_double_colon_split_function_issue469(testdir):
|
|||
def test_double_colon_split_method_issue469(testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
@pytest.mark.parametrize('param', ["double::colon"])
|
||||
def test_func(self, param):
|
||||
pass
|
||||
|
|
|
@ -3,7 +3,7 @@ import os
|
|||
import py, pytest
|
||||
from _pytest.mark import MarkGenerator as Mark
|
||||
|
||||
class TestMark:
|
||||
class TestMark(object):
|
||||
def test_markinfo_repr(self):
|
||||
from _pytest.mark import MarkInfo, Mark
|
||||
m = MarkInfo(Mark("hello", (1,2), {}))
|
||||
|
@ -301,7 +301,7 @@ def test_parametrized_collected_from_command_line(testdir):
|
|||
rec.assertoutcome(passed=3)
|
||||
|
||||
|
||||
class TestFunctional:
|
||||
class TestFunctional(object):
|
||||
|
||||
def test_mark_per_function(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
|
@ -326,7 +326,7 @@ class TestFunctional:
|
|||
def test_marklist_per_class(self, testdir):
|
||||
item = testdir.getitem("""
|
||||
import pytest
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = [pytest.mark.hello, pytest.mark.world]
|
||||
def test_func(self):
|
||||
assert TestClass.test_func.hello
|
||||
|
@ -339,7 +339,7 @@ class TestFunctional:
|
|||
item = testdir.getitem("""
|
||||
import pytest
|
||||
pytestmark = [pytest.mark.hello, pytest.mark.world]
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_func(self):
|
||||
assert TestClass.test_func.hello
|
||||
assert TestClass.test_func.world
|
||||
|
@ -352,7 +352,7 @@ class TestFunctional:
|
|||
item = testdir.getitem("""
|
||||
import pytest
|
||||
@pytest.mark.hello
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_func(self):
|
||||
assert TestClass.test_func.hello
|
||||
""")
|
||||
|
@ -363,7 +363,7 @@ class TestFunctional:
|
|||
item = testdir.getitem("""
|
||||
import pytest
|
||||
@pytest.mark.hello
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = pytest.mark.world
|
||||
def test_func(self):
|
||||
assert TestClass.test_func.hello
|
||||
|
@ -377,7 +377,7 @@ class TestFunctional:
|
|||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
pytestmark = pytest.mark.hello("pos1", x=1, y=2)
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
# classlevel overrides module level
|
||||
pytestmark = pytest.mark.hello(x=3)
|
||||
@pytest.mark.hello("pos0", z=4)
|
||||
|
@ -403,11 +403,11 @@ class TestFunctional:
|
|||
# issue 199 - propagate markers into nested classes
|
||||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
class TestA:
|
||||
class TestA(object):
|
||||
pytestmark = pytest.mark.a
|
||||
def test_b(self):
|
||||
assert True
|
||||
class TestC:
|
||||
class TestC(object):
|
||||
# this one didnt get marked
|
||||
def test_d(self):
|
||||
assert True
|
||||
|
@ -422,7 +422,7 @@ class TestFunctional:
|
|||
import pytest
|
||||
|
||||
@pytest.mark.a
|
||||
class Base: pass
|
||||
class Base(object): pass
|
||||
|
||||
@pytest.mark.b
|
||||
class Test1(Base):
|
||||
|
@ -441,7 +441,7 @@ class TestFunctional:
|
|||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
class TestBase:
|
||||
class TestBase(object):
|
||||
def test_foo(self):
|
||||
pass
|
||||
|
||||
|
@ -465,7 +465,7 @@ class TestFunctional:
|
|||
import pytest
|
||||
|
||||
@pytest.mark.a
|
||||
class Base: pass
|
||||
class Base(object): pass
|
||||
|
||||
@pytest.mark.b
|
||||
class Base2(Base): pass
|
||||
|
@ -485,7 +485,7 @@ class TestFunctional:
|
|||
def test_mark_with_wrong_marker(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
import pytest
|
||||
class pytestmark:
|
||||
class pytestmark(object):
|
||||
pass
|
||||
def test_func():
|
||||
pass
|
||||
|
@ -630,7 +630,7 @@ class TestFunctional:
|
|||
reprec.assertoutcome(skipped=1)
|
||||
|
||||
|
||||
class TestKeywordSelection:
|
||||
class TestKeywordSelection(object):
|
||||
|
||||
def test_select_simple(self, testdir):
|
||||
file_test = testdir.makepyfile("""
|
||||
|
@ -659,7 +659,7 @@ class TestKeywordSelection:
|
|||
p = testdir.makepyfile(test_select="""
|
||||
def test_1():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_2(self):
|
||||
pass
|
||||
""")
|
||||
|
|
|
@ -16,7 +16,7 @@ def mp():
|
|||
|
||||
|
||||
def test_setattr():
|
||||
class A:
|
||||
class A(object):
|
||||
x = 1
|
||||
|
||||
monkeypatch = MonkeyPatch()
|
||||
|
@ -39,7 +39,7 @@ def test_setattr():
|
|||
assert A.x == 5
|
||||
|
||||
|
||||
class TestSetattrWithImportPath:
|
||||
class TestSetattrWithImportPath(object):
|
||||
def test_string_expression(self, monkeypatch):
|
||||
monkeypatch.setattr("os.path.abspath", lambda x: "hello2")
|
||||
assert os.path.abspath("123") == "hello2"
|
||||
|
@ -79,7 +79,7 @@ class TestSetattrWithImportPath:
|
|||
|
||||
|
||||
def test_delattr():
|
||||
class A:
|
||||
class A(object):
|
||||
x = 1
|
||||
|
||||
monkeypatch = MonkeyPatch()
|
||||
|
@ -294,7 +294,7 @@ class SampleNewInherit(SampleNew):
|
|||
pass
|
||||
|
||||
|
||||
class SampleOld:
|
||||
class SampleOld(object):
|
||||
# oldstyle on python2
|
||||
@staticmethod
|
||||
def hello():
|
||||
|
|
|
@ -26,7 +26,7 @@ def test_setup_func_with_setup_decorator():
|
|||
from _pytest.nose import call_optional
|
||||
l = []
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
@pytest.fixture(autouse=True)
|
||||
def f(self):
|
||||
l.append(1)
|
||||
|
@ -38,7 +38,7 @@ def test_setup_func_with_setup_decorator():
|
|||
def test_setup_func_not_callable():
|
||||
from _pytest.nose import call_optional
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
f = 1
|
||||
|
||||
call_optional(A(), "f")
|
||||
|
@ -270,7 +270,7 @@ def test_nose_setup_ordering(testdir):
|
|||
def setup_module(mod):
|
||||
mod.visited = True
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def setup(self):
|
||||
assert visited
|
||||
def test_first(self):
|
||||
|
@ -377,7 +377,7 @@ def test_istest_class_decorator(testdir):
|
|||
p = testdir.makepyfile("""
|
||||
import nose.tools
|
||||
@nose.tools.istest
|
||||
class NotTestPrefix:
|
||||
class NotTestPrefix(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -388,7 +388,7 @@ def test_nottest_class_decorator(testdir):
|
|||
testdir.makepyfile("""
|
||||
import nose.tools
|
||||
@nose.tools.nottest
|
||||
class TestPrefix:
|
||||
class TestPrefix(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
""")
|
||||
|
|
|
@ -8,7 +8,7 @@ from _pytest import config as parseopt
|
|||
def parser():
|
||||
return parseopt.Parser()
|
||||
|
||||
class TestParser:
|
||||
class TestParser(object):
|
||||
def test_no_help_by_default(self, capsys):
|
||||
parser = parseopt.Parser(usage="xyz")
|
||||
pytest.raises(SystemExit, lambda: parser.parse(["-h"]))
|
||||
|
@ -139,7 +139,7 @@ class TestParser:
|
|||
parser.addoption("--hello", dest="hello", action="store")
|
||||
parser.addoption("--world", dest="world", default=42)
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
pass
|
||||
|
||||
option = A()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import sys
|
||||
import pytest
|
||||
|
||||
class TestPasteCapture:
|
||||
class TestPasteCapture(object):
|
||||
|
||||
@pytest.fixture
|
||||
def pastebinlist(self, monkeypatch, request):
|
||||
|
@ -71,7 +71,7 @@ class TestPasteCapture:
|
|||
])
|
||||
|
||||
|
||||
class TestPaste:
|
||||
class TestPaste(object):
|
||||
|
||||
@pytest.fixture
|
||||
def pastebin(self, request):
|
||||
|
@ -88,7 +88,7 @@ class TestPaste:
|
|||
def mocked(url, data):
|
||||
calls.append((url, data))
|
||||
|
||||
class DummyFile:
|
||||
class DummyFile(object):
|
||||
def read(self):
|
||||
# part of html of a normal response
|
||||
return b'View <a href="/raw/3c0c6750bd">raw</a>.'
|
||||
|
|
|
@ -18,7 +18,7 @@ def custom_pdb_calls():
|
|||
called = []
|
||||
|
||||
# install dummy debugger class and track which methods were called on it
|
||||
class _CustomPdb:
|
||||
class _CustomPdb(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
called.append("init")
|
||||
|
||||
|
@ -33,7 +33,7 @@ def custom_pdb_calls():
|
|||
|
||||
|
||||
|
||||
class TestPDB:
|
||||
class TestPDB(object):
|
||||
|
||||
@pytest.fixture
|
||||
def pdblist(self, request):
|
||||
|
@ -374,7 +374,7 @@ class TestPDB:
|
|||
|
||||
def test_pdb_custom_cls_with_settrace(self, testdir, monkeypatch):
|
||||
testdir.makepyfile(custom_pdb="""
|
||||
class CustomPdb:
|
||||
class CustomPdb(object):
|
||||
def set_trace(*args, **kwargs):
|
||||
print 'custom set_trace>'
|
||||
""")
|
||||
|
|
|
@ -11,7 +11,7 @@ from _pytest.main import EXIT_NOTESTSCOLLECTED, Session
|
|||
def pytestpm():
|
||||
return PytestPluginManager()
|
||||
|
||||
class TestPytestPluginInteractions:
|
||||
class TestPytestPluginInteractions(object):
|
||||
def test_addhooks_conftestplugin(self, testdir):
|
||||
testdir.makepyfile(newhooks="""
|
||||
def pytest_myhook(xyz):
|
||||
|
@ -85,7 +85,7 @@ class TestPytestPluginInteractions:
|
|||
config = testdir.parseconfig()
|
||||
l = []
|
||||
|
||||
class A:
|
||||
class A(object):
|
||||
def pytest_configure(self, config):
|
||||
l.append(self)
|
||||
|
||||
|
@ -105,11 +105,11 @@ class TestPytestPluginInteractions:
|
|||
pytestpm = get_config().pluginmanager # fully initialized with plugins
|
||||
saveindent = []
|
||||
|
||||
class api1:
|
||||
class api1(object):
|
||||
def pytest_plugin_registered(self):
|
||||
saveindent.append(pytestpm.trace.root.indent)
|
||||
|
||||
class api2:
|
||||
class api2(object):
|
||||
def pytest_plugin_registered(self):
|
||||
saveindent.append(pytestpm.trace.root.indent)
|
||||
raise ValueError()
|
||||
|
@ -156,11 +156,11 @@ class TestPytestPluginInteractions:
|
|||
def test_warn_on_deprecated_multicall(self, pytestpm):
|
||||
warnings = []
|
||||
|
||||
class get_warnings:
|
||||
class get_warnings(object):
|
||||
def pytest_logwarning(self, message):
|
||||
warnings.append(message)
|
||||
|
||||
class Plugin:
|
||||
class Plugin(object):
|
||||
def pytest_configure(self, __multicall__):
|
||||
pass
|
||||
|
||||
|
@ -173,11 +173,11 @@ class TestPytestPluginInteractions:
|
|||
def test_warn_on_deprecated_addhooks(self, pytestpm):
|
||||
warnings = []
|
||||
|
||||
class get_warnings:
|
||||
class get_warnings(object):
|
||||
def pytest_logwarning(self, code, fslocation, message, nodeid):
|
||||
warnings.append(message)
|
||||
|
||||
class Plugin:
|
||||
class Plugin(object):
|
||||
def pytest_testhook():
|
||||
pass
|
||||
|
||||
|
@ -221,7 +221,7 @@ def test_importplugin_error_message(testdir, pytestpm):
|
|||
assert py.std.re.match(expected, str(excinfo.value))
|
||||
|
||||
|
||||
class TestPytestPluginManager:
|
||||
class TestPytestPluginManager(object):
|
||||
def test_register_imported_modules(self):
|
||||
pm = PytestPluginManager()
|
||||
mod = py.std.types.ModuleType("x.y.pytest_hello")
|
||||
|
@ -348,7 +348,7 @@ class TestPytestPluginManager:
|
|||
pytestpm.consider_conftest(mod)
|
||||
|
||||
|
||||
class TestPytestPluginManagerBootstrapming:
|
||||
class TestPytestPluginManagerBootstrapming(object):
|
||||
def test_preparse_args(self, pytestpm):
|
||||
pytest.raises(ImportError, lambda:
|
||||
pytestpm.consider_preparse(["xyz", "-p", "hello123"]))
|
||||
|
|
|
@ -12,7 +12,7 @@ def test_make_hook_recorder(testdir):
|
|||
|
||||
pytest.xfail("internal reportrecorder tests need refactoring")
|
||||
|
||||
class rep:
|
||||
class rep(object):
|
||||
excinfo = None
|
||||
passed = False
|
||||
failed = True
|
||||
|
@ -25,7 +25,7 @@ def test_make_hook_recorder(testdir):
|
|||
failures = recorder.getfailures()
|
||||
assert failures == [rep]
|
||||
|
||||
class rep:
|
||||
class rep(object):
|
||||
excinfo = None
|
||||
passed = False
|
||||
failed = False
|
||||
|
@ -74,7 +74,7 @@ def test_testdir_runs_with_plugin(testdir):
|
|||
|
||||
|
||||
def make_holder():
|
||||
class apiclass:
|
||||
class apiclass(object):
|
||||
def pytest_xyz(self, arg):
|
||||
"x"
|
||||
def pytest_xyz_noarg(self):
|
||||
|
|
|
@ -70,7 +70,7 @@ def test_write_log_entry():
|
|||
assert entry_lines[1:] == [' '+line for line in longrepr.splitlines()]
|
||||
|
||||
|
||||
class TestWithFunctionIntegration:
|
||||
class TestWithFunctionIntegration(object):
|
||||
# XXX (hpk) i think that the resultlog plugin should
|
||||
# provide a Parser object so that one can remain
|
||||
# ignorant regarding formatting details.
|
||||
|
|
|
@ -8,7 +8,7 @@ import pytest
|
|||
import sys
|
||||
from _pytest import runner, main
|
||||
|
||||
class TestSetupState:
|
||||
class TestSetupState(object):
|
||||
def test_setup(self, testdir):
|
||||
ss = runner.SetupState()
|
||||
item = testdir.getitem("def test_func(): pass")
|
||||
|
@ -71,7 +71,7 @@ class TestSetupState:
|
|||
assert err.value.args == ('oops2',)
|
||||
|
||||
|
||||
class BaseFunctionalTests:
|
||||
class BaseFunctionalTests(object):
|
||||
def test_passfunction(self, testdir):
|
||||
reports = testdir.runitem("""
|
||||
def test_func():
|
||||
|
@ -200,7 +200,7 @@ class BaseFunctionalTests:
|
|||
rec = testdir.inline_runsource("""
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
def teardown_class(cls):
|
||||
|
@ -239,7 +239,7 @@ class BaseFunctionalTests:
|
|||
rec = testdir.inline_runsource("""
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def teardown_method(self, x, y, z):
|
||||
pass
|
||||
|
||||
|
@ -351,12 +351,12 @@ class TestExecutionForked(BaseFunctionalTests):
|
|||
assert rep.failed
|
||||
assert rep.when == "???"
|
||||
|
||||
class TestSessionReports:
|
||||
class TestSessionReports(object):
|
||||
def test_collect_result(self, testdir):
|
||||
col = testdir.getmodulecol("""
|
||||
def test_func1():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pass
|
||||
""")
|
||||
rep = runner.collect_one_node(col)
|
||||
|
@ -409,7 +409,7 @@ def test_runtest_in_module_ordering(testdir):
|
|||
import pytest
|
||||
def pytest_runtest_setup(item): # runs after class-level!
|
||||
item.function.mylist.append("module")
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def pytest_runtest_setup(self, item):
|
||||
assert not hasattr(item.function, 'mylist')
|
||||
item.function.mylist = ['class']
|
||||
|
@ -680,7 +680,7 @@ def test_store_except_info_on_eror():
|
|||
sys.last_traceback and friends.
|
||||
"""
|
||||
# Simulate item that raises a specific exception
|
||||
class ItemThatRaises:
|
||||
class ItemThatRaises(object):
|
||||
def runtest(self):
|
||||
raise IndexError('TEST')
|
||||
try:
|
||||
|
@ -693,7 +693,7 @@ def test_store_except_info_on_eror():
|
|||
assert sys.last_traceback
|
||||
|
||||
|
||||
class TestReportContents:
|
||||
class TestReportContents(object):
|
||||
"""
|
||||
Test user-level API of ``TestReport`` objects.
|
||||
"""
|
||||
|
|
|
@ -24,7 +24,7 @@ def test_module_and_function_setup(testdir):
|
|||
assert modlevel[0] == 42
|
||||
assert test_modlevel.answer == 17
|
||||
|
||||
class TestFromClass:
|
||||
class TestFromClass(object):
|
||||
def test_module(self):
|
||||
assert modlevel[0] == 42
|
||||
assert not hasattr(test_modlevel, 'answer')
|
||||
|
@ -69,7 +69,7 @@ def test_setup_function_failure_no_teardown(testdir):
|
|||
|
||||
def test_class_setup(testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
class TestSimpleClassSetup:
|
||||
class TestSimpleClassSetup(object):
|
||||
clslevel = []
|
||||
def setup_class(cls):
|
||||
cls.clslevel.append(23)
|
||||
|
@ -92,7 +92,7 @@ def test_class_setup(testdir):
|
|||
|
||||
def test_class_setup_failure_no_teardown(testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
class TestSimpleClassSetup:
|
||||
class TestSimpleClassSetup(object):
|
||||
clslevel = []
|
||||
def setup_class(cls):
|
||||
0/0
|
||||
|
@ -110,7 +110,7 @@ def test_class_setup_failure_no_teardown(testdir):
|
|||
|
||||
def test_method_setup(testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
class TestSetupMethod:
|
||||
class TestSetupMethod(object):
|
||||
def setup_method(self, meth):
|
||||
self.methsetup = meth
|
||||
def teardown_method(self, meth):
|
||||
|
@ -126,7 +126,7 @@ def test_method_setup(testdir):
|
|||
|
||||
def test_method_setup_failure_no_teardown(testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
class TestMethodSetup:
|
||||
class TestMethodSetup(object):
|
||||
clslevel = []
|
||||
def setup_method(self, method):
|
||||
self.clslevel.append(1)
|
||||
|
@ -145,7 +145,7 @@ def test_method_setup_failure_no_teardown(testdir):
|
|||
|
||||
def test_method_generator_setup(testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
class TestSetupTeardownOnInstance:
|
||||
class TestSetupTeardownOnInstance(object):
|
||||
def setup_class(cls):
|
||||
cls.classsetup = True
|
||||
|
||||
|
@ -195,7 +195,7 @@ def test_func_generator_setup(testdir):
|
|||
|
||||
def test_method_setup_uses_fresh_instances(testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
class TestSelfState1:
|
||||
class TestSelfState1(object):
|
||||
memory = []
|
||||
def test_hello(self):
|
||||
self.memory.append(self)
|
||||
|
@ -276,7 +276,7 @@ def test_setup_teardown_function_level_with_optional_argument(testdir, monkeypat
|
|||
def test_function_1(): pass
|
||||
def test_function_2(): pass
|
||||
|
||||
class Test:
|
||||
class Test(object):
|
||||
def setup_method(self, {arg}): trace('setup_method')
|
||||
def teardown_method(self, {arg}): trace('teardown_method')
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
|||
|
||||
from _pytest.main import EXIT_NOTESTSCOLLECTED
|
||||
|
||||
class SessionTests:
|
||||
class SessionTests(object):
|
||||
def test_basic_testitem_events(self, testdir):
|
||||
tfile = testdir.makepyfile("""
|
||||
def test_one():
|
||||
|
@ -11,7 +11,7 @@ class SessionTests:
|
|||
assert 0
|
||||
def test_other():
|
||||
raise ValueError(23)
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_two(self, someargs):
|
||||
pass
|
||||
""")
|
||||
|
@ -97,12 +97,12 @@ class SessionTests:
|
|||
def test_broken_repr(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
class BrokenRepr1:
|
||||
class BrokenRepr1(object):
|
||||
foo=0
|
||||
def __repr__(self):
|
||||
raise Exception("Ha Ha fooled you, I'm a broken repr().")
|
||||
|
||||
class TestBrokenClass:
|
||||
class TestBrokenClass(object):
|
||||
def test_explicit_bad_repr(self):
|
||||
t = BrokenRepr1()
|
||||
pytest.raises(Exception, 'repr(t)')
|
||||
|
@ -145,7 +145,7 @@ class TestNewSession(SessionTests):
|
|||
l.append(2)
|
||||
def test_3():
|
||||
assert l == [1,2]
|
||||
class Testmygroup:
|
||||
class Testmygroup(object):
|
||||
reslist = l
|
||||
def test_1(self):
|
||||
self.reslist.append(1)
|
||||
|
@ -167,7 +167,7 @@ class TestNewSession(SessionTests):
|
|||
def test_one():
|
||||
raise ValueError()
|
||||
|
||||
class TestX:
|
||||
class TestX(object):
|
||||
def test_method_one(self):
|
||||
pass
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from _pytest.skipping import MarkEvaluator, folded_skips, pytest_runtest_setup
|
|||
from _pytest.runner import runtestprotocol
|
||||
|
||||
|
||||
class TestEvaluator:
|
||||
class TestEvaluator(object):
|
||||
def test_no_marker(self, testdir):
|
||||
item = testdir.getitem("def test_func(): pass")
|
||||
evalskipif = MarkEvaluator(item, 'skipif')
|
||||
|
@ -114,7 +114,7 @@ class TestEvaluator:
|
|||
def test_skipif_class(self, testdir):
|
||||
item, = testdir.getitems("""
|
||||
import pytest
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = pytest.mark.skipif("config._hackxyz")
|
||||
def test_func(self):
|
||||
pass
|
||||
|
@ -126,7 +126,7 @@ class TestEvaluator:
|
|||
assert expl == "condition: config._hackxyz"
|
||||
|
||||
|
||||
class TestXFail:
|
||||
class TestXFail(object):
|
||||
|
||||
@pytest.mark.parametrize('strict', [True, False])
|
||||
def test_xfail_simple(self, testdir, strict):
|
||||
|
@ -452,7 +452,7 @@ class TestXFail:
|
|||
assert result.ret == (1 if strict else 0)
|
||||
|
||||
|
||||
class TestXFailwithSetupTeardown:
|
||||
class TestXFailwithSetupTeardown(object):
|
||||
def test_failing_setup_issue9(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -484,7 +484,7 @@ class TestXFailwithSetupTeardown:
|
|||
])
|
||||
|
||||
|
||||
class TestSkip:
|
||||
class TestSkip(object):
|
||||
def test_skip_class(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -581,7 +581,7 @@ class TestSkip:
|
|||
"*1 skipped*",
|
||||
])
|
||||
|
||||
class TestSkipif:
|
||||
class TestSkipif(object):
|
||||
def test_skipif_conditional(self, testdir):
|
||||
item = testdir.getitem("""
|
||||
import pytest
|
||||
|
@ -648,7 +648,7 @@ def test_skipif_class(testdir):
|
|||
p = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
pytestmark = pytest.mark.skipif("True")
|
||||
def test_that(self):
|
||||
assert 0
|
||||
|
@ -667,7 +667,7 @@ def test_skip_reasons_folding():
|
|||
message = "justso"
|
||||
longrepr = (path, lineno, message)
|
||||
|
||||
class X:
|
||||
class X(object):
|
||||
pass
|
||||
ev1 = X()
|
||||
ev1.when = "execute"
|
||||
|
@ -694,7 +694,7 @@ def test_skipped_reasons_functional(testdir):
|
|||
doskip()
|
||||
def test_func():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
doskip()
|
||||
""",
|
||||
|
@ -892,7 +892,7 @@ def test_imperativeskip_on_xfail_test(testdir):
|
|||
*2 skipped*
|
||||
""")
|
||||
|
||||
class TestBooleanCondition:
|
||||
class TestBooleanCondition(object):
|
||||
def test_skipif(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
|
|
@ -16,7 +16,7 @@ from _pytest.terminal import build_summary_stats_line, _plugin_nameversions
|
|||
DistInfo = collections.namedtuple('DistInfo', ['project_name', 'version'])
|
||||
|
||||
|
||||
class Option:
|
||||
class Option(object):
|
||||
def __init__(self, verbose=False, fulltrace=False):
|
||||
self.verbose = verbose
|
||||
self.fulltrace = fulltrace
|
||||
|
@ -56,7 +56,7 @@ def test_plugin_nameversion(input, expected):
|
|||
assert result == expected
|
||||
|
||||
|
||||
class TestTerminal:
|
||||
class TestTerminal(object):
|
||||
def test_pass_skip_fail(self, testdir, option):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -127,7 +127,7 @@ class TestTerminal:
|
|||
|
||||
def test_itemreport_subclasses_show_subclassed_file(self, testdir):
|
||||
testdir.makepyfile(test_p1="""
|
||||
class BaseTests:
|
||||
class BaseTests(object):
|
||||
def test_p1(self):
|
||||
pass
|
||||
class TestClass(BaseTests):
|
||||
|
@ -151,7 +151,7 @@ class TestTerminal:
|
|||
def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir):
|
||||
a = testdir.mkpydir("a123")
|
||||
a.join("test_hello123.py").write(_pytest._code.Source("""
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
"""))
|
||||
|
@ -204,7 +204,7 @@ class TestTerminal:
|
|||
result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])
|
||||
|
||||
|
||||
class TestCollectonly:
|
||||
class TestCollectonly(object):
|
||||
def test_collectonly_basic(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
def test_func():
|
||||
|
@ -249,7 +249,7 @@ class TestCollectonly:
|
|||
p = testdir.makepyfile("""
|
||||
def test_func1():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -310,7 +310,7 @@ def test_repr_python_version(monkeypatch):
|
|||
finally:
|
||||
monkeypatch.undo() # do this early as pytest can get confused
|
||||
|
||||
class TestFixtureReporting:
|
||||
class TestFixtureReporting(object):
|
||||
def test_setup_fixture_error(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
def setup_function(function):
|
||||
|
@ -395,7 +395,7 @@ class TestFixtureReporting:
|
|||
"*1 failed*",
|
||||
])
|
||||
|
||||
class TestTerminalFunctional:
|
||||
class TestTerminalFunctional(object):
|
||||
def test_deselected(self, testdir):
|
||||
testpath = testdir.makepyfile("""
|
||||
def test_one():
|
||||
|
@ -431,7 +431,7 @@ class TestTerminalFunctional:
|
|||
p1 = testdir.makepyfile("""
|
||||
def test_passes():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_method(self):
|
||||
pass
|
||||
""")
|
||||
|
@ -487,7 +487,7 @@ class TestTerminalFunctional:
|
|||
raise ValueError()
|
||||
def test_pass():
|
||||
pass
|
||||
class TestClass:
|
||||
class TestClass(object):
|
||||
def test_skip(self):
|
||||
pytest.skip("hello")
|
||||
def test_gen():
|
||||
|
@ -612,8 +612,8 @@ def test_color_yes_collection_on_non_atty(testdir, verbose):
|
|||
|
||||
|
||||
def test_getreportopt():
|
||||
class config:
|
||||
class option:
|
||||
class config(object):
|
||||
class option(object):
|
||||
reportchars = ""
|
||||
disablepytestwarnings = True
|
||||
|
||||
|
@ -683,7 +683,7 @@ def test_traceconfig(testdir, monkeypatch):
|
|||
assert result.ret == EXIT_NOTESTSCOLLECTED
|
||||
|
||||
|
||||
class TestGenericReporting:
|
||||
class TestGenericReporting(object):
|
||||
""" this test class can be subclassed with a different option
|
||||
provider to run e.g. distributed tests.
|
||||
"""
|
||||
|
|
|
@ -34,7 +34,7 @@ def test_ensuretemp(recwarn):
|
|||
assert d1 == d2
|
||||
assert d1.check(dir=1)
|
||||
|
||||
class TestTempdirHandler:
|
||||
class TestTempdirHandler(object):
|
||||
def test_mktemp(self, testdir):
|
||||
from _pytest.tmpdir import TempdirFactory
|
||||
config = testdir.parseconfig()
|
||||
|
@ -48,7 +48,7 @@ class TestTempdirHandler:
|
|||
assert tmp2.relto(t.getbasetemp()).startswith("this")
|
||||
assert tmp2 != tmp
|
||||
|
||||
class TestConfigTmpdir:
|
||||
class TestConfigTmpdir(object):
|
||||
def test_getbasetemp_custom_removes_old(self, testdir):
|
||||
mytemp = testdir.tmpdir.join("xyz")
|
||||
p = testdir.makepyfile("""
|
||||
|
|
|
@ -385,7 +385,7 @@ def test_trial_testfunction_todo_property(testdir):
|
|||
reprec.assertoutcome(skipped=1)
|
||||
|
||||
|
||||
class TestTrialUnittest:
|
||||
class TestTrialUnittest(object):
|
||||
def setup_class(cls):
|
||||
cls.ut = pytest.importorskip("twisted.trial.unittest")
|
||||
|
||||
|
@ -704,7 +704,7 @@ def test_unittest_setup_interaction(testdir, fix_type, stmt):
|
|||
|
||||
def test_non_unittest_no_setupclass_support(testdir):
|
||||
testpath = testdir.makepyfile("""
|
||||
class TestFoo:
|
||||
class TestFoo(object):
|
||||
x = 0
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue