From 9e522c97fa7533e836bb2691533aae7d5a6c26ba Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 24 Nov 2018 08:29:39 -0200 Subject: [PATCH] Try to fix/improve reporting of test_request_garbage * Run it in a subprocess to reduce possible intereference from the outer pytest * Print the leaked objects to see if they provide any hints --- testing/python/fixture.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/testing/python/fixture.py b/testing/python/fixture.py index 1008bd3d8..86cd29724 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -526,15 +526,8 @@ class TestRequestBasic(object): try: gc.collect() - leaked_types = sum(1 for _ in gc.garbage - if isinstance(_, PseudoFixtureDef)) - - # debug leaked types if the test fails - print(leaked_types) - - gc.garbage[:] = [] - - assert leaked_types == 0 + leaked = [x for _ in gc.garbage if isinstance(_, PseudoFixtureDef)] + assert leaked == [] finally: gc.set_debug(original) @@ -542,7 +535,7 @@ class TestRequestBasic(object): pass """ ) - result = testdir.runpytest() + result = testdir.runpytest_subprocess() result.stdout.fnmatch_lines("* 1 passed in *") def test_getfixturevalue_recursive(self, testdir):