Merge pull request #4436 from asottile/print_function
Fix formatting of print() calls
This commit is contained in:
commit
94d032a6de
|
@ -52,7 +52,7 @@ is that you can use print statements for debugging::
|
|||
# content of test_module.py
|
||||
|
||||
def setup_function(function):
|
||||
print ("setting up %s" % function)
|
||||
print("setting up %s" % function)
|
||||
|
||||
def test_func1():
|
||||
assert True
|
||||
|
|
|
@ -466,7 +466,7 @@ test function. From a conftest file we can read it like this::
|
|||
|
||||
def pytest_runtest_setup(item):
|
||||
for mark in item.iter_markers(name='glob'):
|
||||
print ("glob args=%s kwargs=%s" %(mark.args, mark.kwargs))
|
||||
print("glob args=%s kwargs=%s" % (mark.args, mark.kwargs))
|
||||
sys.stdout.flush()
|
||||
|
||||
Let's run this without capturing output and see what we get::
|
||||
|
|
|
@ -13,7 +13,7 @@ calls it::
|
|||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def callattr_ahead_of_alltests(request):
|
||||
print ("callattr_ahead_of_alltests called")
|
||||
print("callattr_ahead_of_alltests called")
|
||||
seen = set([None])
|
||||
session = request.node
|
||||
for item in session.items:
|
||||
|
@ -31,20 +31,20 @@ will be called ahead of running any tests::
|
|||
class TestHello(object):
|
||||
@classmethod
|
||||
def callme(cls):
|
||||
print ("callme called!")
|
||||
print("callme called!")
|
||||
|
||||
def test_method1(self):
|
||||
print ("test_method1 called")
|
||||
print("test_method1 called")
|
||||
|
||||
def test_method2(self):
|
||||
print ("test_method1 called")
|
||||
print("test_method1 called")
|
||||
|
||||
class TestOther(object):
|
||||
@classmethod
|
||||
def callme(cls):
|
||||
print ("callme other called")
|
||||
print("callme other called")
|
||||
def test_other(self):
|
||||
print ("test other")
|
||||
print("test other")
|
||||
|
||||
# works with unittest as well ...
|
||||
import unittest
|
||||
|
@ -52,10 +52,10 @@ will be called ahead of running any tests::
|
|||
class SomeTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def callme(self):
|
||||
print ("SomeTest callme called")
|
||||
print("SomeTest callme called")
|
||||
|
||||
def test_unit1(self):
|
||||
print ("test_unit1 method called")
|
||||
print("test_unit1 method called")
|
||||
|
||||
If you run this without output capturing::
|
||||
|
||||
|
|
|
@ -460,7 +460,7 @@ read an optional server URL from the test module which uses our fixture::
|
|||
server = getattr(request.module, "smtpserver", "smtp.gmail.com")
|
||||
smtp_connection = smtplib.SMTP(server, 587, timeout=5)
|
||||
yield smtp_connection
|
||||
print ("finalizing %s (%s)" % (smtp_connection, server))
|
||||
print("finalizing %s (%s)" % (smtp_connection, server))
|
||||
smtp_connection.close()
|
||||
|
||||
We use the ``request.module`` attribute to optionally obtain an
|
||||
|
@ -821,23 +821,23 @@ to show the setup/teardown flow::
|
|||
@pytest.fixture(scope="module", params=["mod1", "mod2"])
|
||||
def modarg(request):
|
||||
param = request.param
|
||||
print (" SETUP modarg %s" % param)
|
||||
print(" SETUP modarg %s" % param)
|
||||
yield param
|
||||
print (" TEARDOWN modarg %s" % param)
|
||||
print(" TEARDOWN modarg %s" % param)
|
||||
|
||||
@pytest.fixture(scope="function", params=[1,2])
|
||||
def otherarg(request):
|
||||
param = request.param
|
||||
print (" SETUP otherarg %s" % param)
|
||||
print(" SETUP otherarg %s" % param)
|
||||
yield param
|
||||
print (" TEARDOWN otherarg %s" % param)
|
||||
print(" TEARDOWN otherarg %s" % param)
|
||||
|
||||
def test_0(otherarg):
|
||||
print (" RUN test0 with otherarg %s" % otherarg)
|
||||
print(" RUN test0 with otherarg %s" % otherarg)
|
||||
def test_1(modarg):
|
||||
print (" RUN test1 with modarg %s" % modarg)
|
||||
print(" RUN test1 with modarg %s" % modarg)
|
||||
def test_2(otherarg, modarg):
|
||||
print (" RUN test2 with otherarg %s and modarg %s" % (otherarg, modarg))
|
||||
print(" RUN test2 with otherarg %s and modarg %s" % (otherarg, modarg))
|
||||
|
||||
|
||||
Let's run the tests in verbose mode and with looking at the print-output::
|
||||
|
|
|
@ -26,9 +26,9 @@ a per-session Database object::
|
|||
# content of conftest.py
|
||||
class Database(object):
|
||||
def __init__(self):
|
||||
print ("database instance created")
|
||||
print("database instance created")
|
||||
def destroy(self):
|
||||
print ("database instance destroyed")
|
||||
print("database instance destroyed")
|
||||
|
||||
def pytest_funcarg__db(request):
|
||||
return request.cached_setup(setup=DataBase,
|
||||
|
|
|
@ -138,7 +138,7 @@ Request a unique temporary directory for functional tests
|
|||
|
||||
# content of test_tmpdir.py
|
||||
def test_needsfiles(tmpdir):
|
||||
print (tmpdir)
|
||||
print(tmpdir)
|
||||
assert 0
|
||||
|
||||
List the name ``tmpdir`` in the test function signature and ``pytest`` will lookup and call a fixture factory to create the resource before performing the test function call. Before the test runs, ``pytest`` creates a unique-per-test-invocation temporary directory::
|
||||
|
@ -151,7 +151,7 @@ List the name ``tmpdir`` in the test function signature and ``pytest`` will look
|
|||
tmpdir = local('PYTEST_TMPDIR/test_needsfiles0')
|
||||
|
||||
def test_needsfiles(tmpdir):
|
||||
print (tmpdir)
|
||||
print(tmpdir)
|
||||
> assert 0
|
||||
E assert 0
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ sub directory but not for other directories::
|
|||
a/conftest.py:
|
||||
def pytest_runtest_setup(item):
|
||||
# called for running each test in 'a' directory
|
||||
print ("setting up", item)
|
||||
print("setting up", item)
|
||||
|
||||
a/test_sub.py:
|
||||
def test_sub():
|
||||
|
|
|
@ -65,9 +65,9 @@ def report(issues):
|
|||
print(title)
|
||||
# print()
|
||||
# lines = body.split("\n")
|
||||
# print ("\n".join(lines[:3]))
|
||||
# print("\n".join(lines[:3]))
|
||||
# if len(lines) > 3 or len(body) > 240:
|
||||
# print ("...")
|
||||
# print("...")
|
||||
print("\n\nFound %s open issues" % len(issues))
|
||||
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ class TestGeneralUsage(object):
|
|||
testdir.makeconftest(
|
||||
"""
|
||||
import sys
|
||||
print ("should not be seen")
|
||||
print("should not be seen")
|
||||
sys.stderr.write("stder42\\n")
|
||||
"""
|
||||
)
|
||||
|
@ -218,7 +218,7 @@ class TestGeneralUsage(object):
|
|||
def test_conftest_printing_shows_if_error(self, testdir):
|
||||
testdir.makeconftest(
|
||||
"""
|
||||
print ("should be seen")
|
||||
print("should be seen")
|
||||
assert 0
|
||||
"""
|
||||
)
|
||||
|
@ -301,7 +301,7 @@ class TestGeneralUsage(object):
|
|||
def pytest_generate_tests(metafunc):
|
||||
metafunc.addcall({'x': 3}, id='hello-123')
|
||||
def pytest_runtest_setup(item):
|
||||
print (item.keywords)
|
||||
print(item.keywords)
|
||||
if 'hello-123' in item.keywords:
|
||||
pytest.skip("hello")
|
||||
assert 0
|
||||
|
|
|
@ -1495,7 +1495,7 @@ class TestFixtureManagerParseFactories(object):
|
|||
return "class"
|
||||
def test_hello(self, item, fm):
|
||||
faclist = fm.getfixturedefs("hello", item.nodeid)
|
||||
print (faclist)
|
||||
print(faclist)
|
||||
assert len(faclist) == 3
|
||||
|
||||
assert faclist[0].func(item._request) == "conftest"
|
||||
|
@ -2040,7 +2040,7 @@ class TestAutouseManagement(object):
|
|||
values.append("step2-%d" % item)
|
||||
|
||||
def test_finish():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == ["setup-1", "step1-1", "step2-1", "teardown-1",
|
||||
"setup-2", "step1-2", "step2-2", "teardown-2",]
|
||||
"""
|
||||
|
@ -2880,7 +2880,7 @@ class TestFixtureMarker(object):
|
|||
def base(request, fix1):
|
||||
def cleanup_base():
|
||||
values.append("fin_base")
|
||||
print ("finalizing base")
|
||||
print("finalizing base")
|
||||
request.addfinalizer(cleanup_base)
|
||||
|
||||
def test_begin():
|
||||
|
@ -3480,13 +3480,13 @@ class TestContextManagerFixtureFuncs(object):
|
|||
from test_context import fixture
|
||||
@fixture
|
||||
def arg1():
|
||||
print ("setup")
|
||||
print("setup")
|
||||
yield 1
|
||||
print ("teardown")
|
||||
print("teardown")
|
||||
def test_1(arg1):
|
||||
print ("test1", arg1)
|
||||
print("test1", arg1)
|
||||
def test_2(arg1):
|
||||
print ("test2", arg1)
|
||||
print("test2", arg1)
|
||||
assert 0
|
||||
"""
|
||||
)
|
||||
|
@ -3509,13 +3509,13 @@ class TestContextManagerFixtureFuncs(object):
|
|||
from test_context import fixture
|
||||
@fixture(scope="module")
|
||||
def arg1():
|
||||
print ("setup")
|
||||
print("setup")
|
||||
yield 1
|
||||
print ("teardown")
|
||||
print("teardown")
|
||||
def test_1(arg1):
|
||||
print ("test1", arg1)
|
||||
print("test1", arg1)
|
||||
def test_2(arg1):
|
||||
print ("test2", arg1)
|
||||
print("test2", arg1)
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest("-s")
|
||||
|
|
|
@ -283,7 +283,7 @@ class TestReRunTests(object):
|
|||
global count, req
|
||||
assert request != req
|
||||
req = request
|
||||
print ("fix count %s" % count)
|
||||
print("fix count %s" % count)
|
||||
count += 1
|
||||
def test_fix(fix):
|
||||
pass
|
||||
|
|
|
@ -43,7 +43,7 @@ class TestRaises(object):
|
|||
with pytest.raises(ZeroDivisionError) as excinfo:
|
||||
assert isinstance(excinfo, _pytest._code.ExceptionInfo)
|
||||
1/0
|
||||
print (excinfo)
|
||||
print(excinfo)
|
||||
assert excinfo.type == ZeroDivisionError
|
||||
assert isinstance(excinfo.value, ZeroDivisionError)
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ def test_capturing_unicode(testdir, method):
|
|||
# taken from issue 227 from nosetests
|
||||
def test_unicode():
|
||||
import sys
|
||||
print (sys.stdout)
|
||||
print (%s)
|
||||
print(sys.stdout)
|
||||
print(%s)
|
||||
"""
|
||||
% obj
|
||||
)
|
||||
|
@ -121,7 +121,7 @@ def test_capturing_bytes_in_utf8_encoding(testdir, method):
|
|||
testdir.makepyfile(
|
||||
"""
|
||||
def test_unicode():
|
||||
print ('b\\u00f6y')
|
||||
print('b\\u00f6y')
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest("--capture=%s" % method)
|
||||
|
@ -131,7 +131,7 @@ def test_capturing_bytes_in_utf8_encoding(testdir, method):
|
|||
def test_collect_capturing(testdir):
|
||||
p = testdir.makepyfile(
|
||||
"""
|
||||
print ("collect %s failure" % 13)
|
||||
print("collect %s failure" % 13)
|
||||
import xyz42123
|
||||
"""
|
||||
)
|
||||
|
@ -144,14 +144,14 @@ class TestPerTestCapturing(object):
|
|||
p = testdir.makepyfile(
|
||||
"""
|
||||
def setup_module(mod):
|
||||
print ("setup module")
|
||||
print("setup module")
|
||||
def setup_function(function):
|
||||
print ("setup " + function.__name__)
|
||||
print("setup " + function.__name__)
|
||||
def test_func1():
|
||||
print ("in func1")
|
||||
print("in func1")
|
||||
assert 0
|
||||
def test_func2():
|
||||
print ("in func2")
|
||||
print("in func2")
|
||||
assert 0
|
||||
"""
|
||||
)
|
||||
|
@ -172,14 +172,14 @@ class TestPerTestCapturing(object):
|
|||
"""
|
||||
import sys
|
||||
def setup_module(func):
|
||||
print ("module-setup")
|
||||
print("module-setup")
|
||||
def setup_function(func):
|
||||
print ("function-setup")
|
||||
print("function-setup")
|
||||
def test_func():
|
||||
print ("in function")
|
||||
print("in function")
|
||||
assert 0
|
||||
def teardown_function(func):
|
||||
print ("in teardown")
|
||||
print("in teardown")
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest(p)
|
||||
|
@ -198,9 +198,9 @@ class TestPerTestCapturing(object):
|
|||
p = testdir.makepyfile(
|
||||
"""
|
||||
def test_func1():
|
||||
print ("in func1")
|
||||
print("in func1")
|
||||
def test_func2():
|
||||
print ("in func2")
|
||||
print("in func2")
|
||||
assert 0
|
||||
"""
|
||||
)
|
||||
|
@ -213,12 +213,12 @@ class TestPerTestCapturing(object):
|
|||
p = testdir.makepyfile(
|
||||
"""
|
||||
def setup_function(function):
|
||||
print ("setup func1")
|
||||
print("setup func1")
|
||||
def teardown_function(function):
|
||||
print ("teardown func1")
|
||||
print("teardown func1")
|
||||
assert 0
|
||||
def test_func1():
|
||||
print ("in func1")
|
||||
print("in func1")
|
||||
pass
|
||||
"""
|
||||
)
|
||||
|
@ -238,7 +238,7 @@ class TestPerTestCapturing(object):
|
|||
p = testdir.makepyfile(
|
||||
"""
|
||||
def teardown_module(mod):
|
||||
print ("teardown module")
|
||||
print("teardown module")
|
||||
assert 0
|
||||
def test_func():
|
||||
pass
|
||||
|
@ -259,10 +259,10 @@ class TestPerTestCapturing(object):
|
|||
"""\
|
||||
import sys
|
||||
def test_capturing():
|
||||
print (42)
|
||||
print(42)
|
||||
sys.stderr.write(str(23))
|
||||
def test_capturing_error():
|
||||
print (1)
|
||||
print(1)
|
||||
sys.stderr.write(str(2))
|
||||
raise ValueError
|
||||
"""
|
||||
|
@ -392,7 +392,7 @@ class TestCaptureFixture(object):
|
|||
reprec = testdir.inline_runsource(
|
||||
"""\
|
||||
def test_hello(capsys):
|
||||
print (42)
|
||||
print(42)
|
||||
out, err = capsys.readouterr()
|
||||
assert out.startswith("42")
|
||||
""",
|
||||
|
@ -460,7 +460,7 @@ class TestCaptureFixture(object):
|
|||
p = testdir.makepyfile(
|
||||
"""\
|
||||
def test_hello(cap{}):
|
||||
print ("xxx42xxx")
|
||||
print("xxx42xxx")
|
||||
assert 0
|
||||
""".format(
|
||||
method
|
||||
|
@ -702,7 +702,7 @@ def test_capture_conftest_runtest_setup(testdir):
|
|||
testdir.makeconftest(
|
||||
"""
|
||||
def pytest_runtest_setup():
|
||||
print ("hello19")
|
||||
print("hello19")
|
||||
"""
|
||||
)
|
||||
testdir.makepyfile("def test_func(): pass")
|
||||
|
@ -737,7 +737,7 @@ def test_capture_early_option_parsing(testdir):
|
|||
testdir.makeconftest(
|
||||
"""
|
||||
def pytest_runtest_setup():
|
||||
print ("hello19")
|
||||
print("hello19")
|
||||
"""
|
||||
)
|
||||
testdir.makepyfile("def test_func(): pass")
|
||||
|
@ -1302,14 +1302,14 @@ def test_capturing_and_logging_fundamentals(testdir, method):
|
|||
|
||||
logging.warn("hello1")
|
||||
outerr = cap.readouterr()
|
||||
print ("suspend, captured %%s" %%(outerr,))
|
||||
print("suspend, captured %%s" %%(outerr,))
|
||||
logging.warn("hello2")
|
||||
|
||||
cap.pop_outerr_to_orig()
|
||||
logging.warn("hello3")
|
||||
|
||||
outerr = cap.readouterr()
|
||||
print ("suspend2, captured %%s" %% (outerr,))
|
||||
print("suspend2, captured %%s" %% (outerr,))
|
||||
"""
|
||||
% (method,)
|
||||
)
|
||||
|
|
|
@ -371,7 +371,7 @@ class TestPython(object):
|
|||
import sys
|
||||
|
||||
def test_fail():
|
||||
print ("hello-stdout")
|
||||
print("hello-stdout")
|
||||
sys.stderr.write("hello-stderr\\n")
|
||||
logging.info('info msg')
|
||||
logging.warning('warning msg')
|
||||
|
@ -589,7 +589,7 @@ class TestPython(object):
|
|||
"""
|
||||
# coding: latin1
|
||||
def test_hello():
|
||||
print (%r)
|
||||
print(%r)
|
||||
assert 0
|
||||
"""
|
||||
% value
|
||||
|
|
|
@ -189,7 +189,7 @@ def test_ini_markers(testdir):
|
|||
"""
|
||||
def test_markers(pytestconfig):
|
||||
markers = pytestconfig.getini("markers")
|
||||
print (markers)
|
||||
print(markers)
|
||||
assert len(markers) >= 2
|
||||
assert markers[0].startswith("a1:")
|
||||
assert markers[1].startswith("a2:")
|
||||
|
|
|
@ -71,11 +71,11 @@ def test_nose_setup_func(testdir):
|
|||
|
||||
@with_setup(my_setup, my_teardown)
|
||||
def test_hello():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == [1]
|
||||
|
||||
def test_world():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == [1,2]
|
||||
|
||||
"""
|
||||
|
@ -95,11 +95,11 @@ def test_nose_setup_func_failure(testdir):
|
|||
|
||||
@with_setup(my_setup, my_teardown)
|
||||
def test_hello():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == [1]
|
||||
|
||||
def test_world():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == [1,2]
|
||||
|
||||
"""
|
||||
|
@ -147,11 +147,11 @@ def test_nose_setup_partial(testdir):
|
|||
my_teardown_partial = partial(my_teardown, 2)
|
||||
|
||||
def test_hello():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == [1]
|
||||
|
||||
def test_world():
|
||||
print (values)
|
||||
print(values)
|
||||
assert values == [1,2]
|
||||
|
||||
test_hello.setup = my_setup_partial
|
||||
|
@ -202,21 +202,21 @@ def test_nose_test_generator_fixtures(testdir):
|
|||
|
||||
class TestClass(object):
|
||||
def setup(self):
|
||||
print ("setup called in %s" % self)
|
||||
print("setup called in %s" % self)
|
||||
self.called = ['setup']
|
||||
|
||||
def teardown(self):
|
||||
print ("teardown called in %s" % self)
|
||||
print("teardown called in %s" % self)
|
||||
eq_(self.called, ['setup'])
|
||||
self.called.append('teardown')
|
||||
|
||||
def test(self):
|
||||
print ("test called in %s" % self)
|
||||
print("test called in %s" % self)
|
||||
for i in range(0, 5):
|
||||
yield self.check, i
|
||||
|
||||
def check(self, i):
|
||||
print ("check called in %s" % self)
|
||||
print("check called in %s" % self)
|
||||
expect = ['setup']
|
||||
#for x in range(0, i):
|
||||
# expect.append('setup')
|
||||
|
|
|
@ -202,21 +202,21 @@ def test_func_generator_setup(testdir):
|
|||
import sys
|
||||
|
||||
def setup_module(mod):
|
||||
print ("setup_module")
|
||||
print("setup_module")
|
||||
mod.x = []
|
||||
|
||||
def setup_function(fun):
|
||||
print ("setup_function")
|
||||
print("setup_function")
|
||||
x.append(1)
|
||||
|
||||
def teardown_function(fun):
|
||||
print ("teardown_function")
|
||||
print("teardown_function")
|
||||
x.pop()
|
||||
|
||||
def test_one():
|
||||
assert x == [1]
|
||||
def check():
|
||||
print ("check")
|
||||
print("check")
|
||||
sys.stderr.write("e\\n")
|
||||
assert x == [1]
|
||||
yield check
|
||||
|
|
|
@ -365,7 +365,7 @@ class TestFixtureReporting(object):
|
|||
testdir.makepyfile(
|
||||
"""
|
||||
def setup_function(function):
|
||||
print ("setup func")
|
||||
print("setup func")
|
||||
assert 0
|
||||
def test_nada():
|
||||
pass
|
||||
|
@ -389,7 +389,7 @@ class TestFixtureReporting(object):
|
|||
def test_nada():
|
||||
pass
|
||||
def teardown_function(function):
|
||||
print ("teardown func")
|
||||
print("teardown func")
|
||||
assert 0
|
||||
"""
|
||||
)
|
||||
|
@ -412,7 +412,7 @@ class TestFixtureReporting(object):
|
|||
assert 0, "failingfunc"
|
||||
|
||||
def teardown_function(function):
|
||||
print ("teardown func")
|
||||
print("teardown func")
|
||||
assert False
|
||||
"""
|
||||
)
|
||||
|
@ -436,13 +436,13 @@ class TestFixtureReporting(object):
|
|||
testdir.makepyfile(
|
||||
"""
|
||||
def setup_function(function):
|
||||
print ("setup func")
|
||||
print("setup func")
|
||||
|
||||
def test_fail():
|
||||
assert 0, "failingfunc"
|
||||
|
||||
def teardown_function(function):
|
||||
print ("teardown func")
|
||||
print("teardown func")
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
|
@ -854,7 +854,7 @@ class TestGenericReporting(object):
|
|||
def g():
|
||||
raise IndexError
|
||||
def test_func():
|
||||
print (6*7)
|
||||
print(6*7)
|
||||
g() # --calling--
|
||||
"""
|
||||
)
|
||||
|
@ -863,9 +863,9 @@ class TestGenericReporting(object):
|
|||
result = testdir.runpytest("--tb=%s" % tbopt)
|
||||
s = result.stdout.str()
|
||||
if tbopt == "long":
|
||||
assert "print (6*7)" in s
|
||||
assert "print(6*7)" in s
|
||||
else:
|
||||
assert "print (6*7)" not in s
|
||||
assert "print(6*7)" not in s
|
||||
if tbopt != "no":
|
||||
assert "--calling--" in s
|
||||
assert "IndexError" in s
|
||||
|
@ -881,7 +881,7 @@ class TestGenericReporting(object):
|
|||
def g():
|
||||
raise IndexError
|
||||
def test_func1():
|
||||
print (6*7)
|
||||
print(6*7)
|
||||
g() # --calling--
|
||||
def test_func2():
|
||||
assert 0, "hello"
|
||||
|
|
|
@ -244,7 +244,7 @@ def test_setup_failure_is_shown(testdir):
|
|||
def setUp(self):
|
||||
assert 0, "down1"
|
||||
def test_method(self):
|
||||
print ("never42")
|
||||
print("never42")
|
||||
xyz
|
||||
"""
|
||||
)
|
||||
|
@ -610,14 +610,14 @@ def test_djangolike_testcase(testdir):
|
|||
class DjangoLikeTestCase(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
print ("setUp()")
|
||||
print("setUp()")
|
||||
|
||||
def test_presetup_has_been_run(self):
|
||||
print ("test_thing()")
|
||||
print("test_thing()")
|
||||
self.assertTrue(hasattr(self, 'was_presetup'))
|
||||
|
||||
def tearDown(self):
|
||||
print ("tearDown()")
|
||||
print("tearDown()")
|
||||
|
||||
def __call__(self, result=None):
|
||||
try:
|
||||
|
@ -639,11 +639,11 @@ def test_djangolike_testcase(testdir):
|
|||
return
|
||||
|
||||
def _pre_setup(self):
|
||||
print ("_pre_setup()")
|
||||
print("_pre_setup()")
|
||||
self.was_presetup = True
|
||||
|
||||
def _post_teardown(self):
|
||||
print ("_post_teardown()")
|
||||
print("_post_teardown()")
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest("-s")
|
||||
|
|
Loading…
Reference in New Issue