From 0b8b006db49371fe70e51828454d95a0aaa016e3 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 9 May 2019 15:36:49 +0200 Subject: [PATCH 1/3] minor: improve formatting --- src/_pytest/fixtures.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 902904457..53df79d35 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -853,11 +853,9 @@ class FixtureDef(object): exceptions.append(sys.exc_info()) if exceptions: e = exceptions[0] - del ( - exceptions - ) # ensure we don't keep all frames alive because of the traceback + # Ensure to not keep frame references through traceback. + del exceptions six.reraise(*e) - finally: hook = self._fixturemanager.session.gethookproxy(request.node.fspath) hook.pytest_fixture_post_finalizer(fixturedef=self, request=request) From f8e1d58e8f3552b5e0473a735f501f6b147c8b85 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 14 May 2019 06:51:30 +0200 Subject: [PATCH 2/3] minor: settrace != set_trace --- testing/test_pdb.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 3b21bacd9..b9c216eaf 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -817,7 +817,7 @@ class TestPDB(object): result.stdout.fnmatch_lines(["*NameError*xxx*", "*1 error*"]) 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( custom_pdb=""" class CustomPdb(object): @@ -1129,14 +1129,14 @@ def test_pdbcls_via_local_module(testdir): p1 = testdir.makepyfile( """ def test(): - print("before_settrace") + print("before_set_trace") __import__("pdb").set_trace() """, mypdb=""" class Wrapped: class MyPdb: def set_trace(self, *args): - print("settrace_called", args) + print("set_trace_called", args) def runcall(self, *args, **kwds): print("runcall_called", args, kwds) @@ -1157,7 +1157,7 @@ def test_pdbcls_via_local_module(testdir): str(p1), "--pdbcls=mypdb:Wrapped.MyPdb", syspathinsert=True ) 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. result = testdir.runpytest( From c081c01eb1b4191e1bc241b331b644ca91b900b1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 14 May 2019 06:51:49 +0200 Subject: [PATCH 3/3] minor: s/no covers/no cover/ --- testing/test_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_session.py b/testing/test_session.py index 377b28937..03f30f32b 100644 --- a/testing/test_session.py +++ b/testing/test_session.py @@ -171,7 +171,7 @@ class SessionTests(object): ) try: 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") reports = reprec.getreports("pytest_collectreport") assert len(reports) == 1