Merge pull request #5308 from blueyed/minor

Minor fixes
This commit is contained in:
Anthony Sottile 2019-05-25 21:58:39 -07:00 committed by GitHub
commit b3f8fabac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -853,11 +853,9 @@ class FixtureDef(object):
exceptions.append(sys.exc_info()) exceptions.append(sys.exc_info())
if exceptions: if exceptions:
e = exceptions[0] e = exceptions[0]
del ( # Ensure to not keep frame references through traceback.
exceptions del exceptions
) # ensure we don't keep all frames alive because of the traceback
six.reraise(*e) six.reraise(*e)
finally: finally:
hook = self._fixturemanager.session.gethookproxy(request.node.fspath) hook = self._fixturemanager.session.gethookproxy(request.node.fspath)
hook.pytest_fixture_post_finalizer(fixturedef=self, request=request) hook.pytest_fixture_post_finalizer(fixturedef=self, request=request)

View File

@ -817,7 +817,7 @@ class TestPDB(object):
result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"]) result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"])
assert custom_pdb_calls == [] assert custom_pdb_calls == []
def test_pdb_custom_cls_with_settrace(self, testdir, monkeypatch): def test_pdb_custom_cls_with_set_trace(self, testdir, monkeypatch):
testdir.makepyfile( testdir.makepyfile(
custom_pdb=""" custom_pdb="""
class CustomPdb(object): class CustomPdb(object):
@ -1133,14 +1133,14 @@ def test_pdbcls_via_local_module(testdir):
p1 = testdir.makepyfile( p1 = testdir.makepyfile(
""" """
def test(): def test():
print("before_settrace") print("before_set_trace")
__import__("pdb").set_trace() __import__("pdb").set_trace()
""", """,
mypdb=""" mypdb="""
class Wrapped: class Wrapped:
class MyPdb: class MyPdb:
def set_trace(self, *args): def set_trace(self, *args):
print("settrace_called", args) print("set_trace_called", args)
def runcall(self, *args, **kwds): def runcall(self, *args, **kwds):
print("runcall_called", args, kwds) print("runcall_called", args, kwds)
@ -1161,7 +1161,7 @@ def test_pdbcls_via_local_module(testdir):
str(p1), "--pdbcls=mypdb:Wrapped.MyPdb", syspathinsert=True str(p1), "--pdbcls=mypdb:Wrapped.MyPdb", syspathinsert=True
) )
assert result.ret == 0 assert result.ret == 0
result.stdout.fnmatch_lines(["*settrace_called*", "* 1 passed in *"]) result.stdout.fnmatch_lines(["*set_trace_called*", "* 1 passed in *"])
# Ensure that it also works with --trace. # Ensure that it also works with --trace.
result = testdir.runpytest( result = testdir.runpytest(

View File

@ -171,7 +171,7 @@ class SessionTests(object):
) )
try: try:
reprec = testdir.inline_run(testdir.tmpdir) reprec = testdir.inline_run(testdir.tmpdir)
except pytest.skip.Exception: # pragma: no covers except pytest.skip.Exception: # pragma: no cover
pytest.fail("wrong skipped caught") pytest.fail("wrong skipped caught")
reports = reprec.getreports("pytest_collectreport") reports = reprec.getreports("pytest_collectreport")
assert len(reports) == 1 assert len(reports) == 1