Merge master into merge-master-into-features
This commit is contained in:
commit
5bee396e4b
|
@ -0,0 +1 @@
|
||||||
|
Fix ``raises(..., 'code(string)')`` frame filename.
|
|
@ -679,7 +679,7 @@ def raises(expected_exception, *args, **kwargs):
|
||||||
loc.update(kwargs)
|
loc.update(kwargs)
|
||||||
# print "raises frame scope: %r" % frame.f_locals
|
# print "raises frame scope: %r" % frame.f_locals
|
||||||
try:
|
try:
|
||||||
code = _pytest._code.Source(code).compile()
|
code = _pytest._code.Source(code).compile(_genframe=frame)
|
||||||
six.exec_(code, frame.f_globals, loc)
|
six.exec_(code, frame.f_globals, loc)
|
||||||
# XXX didn't mean f_globals == f_locals something special?
|
# XXX didn't mean f_globals == f_locals something special?
|
||||||
# this is destroyed here ...
|
# this is destroyed here ...
|
||||||
|
|
|
@ -526,15 +526,8 @@ class TestRequestBasic(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gc.collect()
|
gc.collect()
|
||||||
leaked_types = sum(1 for _ in gc.garbage
|
leaked = [x for _ in gc.garbage if isinstance(_, PseudoFixtureDef)]
|
||||||
if isinstance(_, PseudoFixtureDef))
|
assert leaked == []
|
||||||
|
|
||||||
# debug leaked types if the test fails
|
|
||||||
print(leaked_types)
|
|
||||||
|
|
||||||
gc.garbage[:] = []
|
|
||||||
|
|
||||||
assert leaked_types == 0
|
|
||||||
finally:
|
finally:
|
||||||
gc.set_debug(original)
|
gc.set_debug(original)
|
||||||
|
|
||||||
|
@ -542,7 +535,7 @@ class TestRequestBasic(object):
|
||||||
pass
|
pass
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest_subprocess()
|
||||||
result.stdout.fnmatch_lines("* 1 passed in *")
|
result.stdout.fnmatch_lines("* 1 passed in *")
|
||||||
|
|
||||||
def test_getfixturevalue_recursive(self, testdir):
|
def test_getfixturevalue_recursive(self, testdir):
|
||||||
|
|
|
@ -17,6 +17,10 @@ class TestRaises(object):
|
||||||
def test_raises_exec(self):
|
def test_raises_exec(self):
|
||||||
pytest.raises(ValueError, "a,x = []")
|
pytest.raises(ValueError, "a,x = []")
|
||||||
|
|
||||||
|
def test_raises_exec_correct_filename(self):
|
||||||
|
excinfo = pytest.raises(ValueError, 'int("s")')
|
||||||
|
assert __file__ in excinfo.traceback[-1].path
|
||||||
|
|
||||||
def test_raises_syntax_error(self):
|
def test_raises_syntax_error(self):
|
||||||
pytest.raises(SyntaxError, "qwe qwe qwe")
|
pytest.raises(SyntaxError, "qwe qwe qwe")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue