Merge remote-tracking branch 'upstream/master' into merge-master-into-features
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -33,6 +33,23 @@ class TestRaises(object):
|
||||
except pytest.raises.Exception:
|
||||
pass
|
||||
|
||||
def test_raises_repr_inflight(self):
|
||||
"""Ensure repr() on an exception info inside a pytest.raises with block works (#4386)"""
|
||||
|
||||
class E(Exception):
|
||||
pass
|
||||
|
||||
with pytest.raises(E) as excinfo:
|
||||
# this test prints the inflight uninitialized object
|
||||
# using repr and str as well as pprint to demonstrate
|
||||
# it works
|
||||
print(str(excinfo))
|
||||
print(repr(excinfo))
|
||||
import pprint
|
||||
|
||||
pprint.pprint(excinfo)
|
||||
raise E()
|
||||
|
||||
def test_raises_as_contextmanager(self, testdir):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
@@ -43,7 +60,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user