-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressedtype: infrastructureimprovement to development/releases/CI structureimprovement to development/releases/CI structure
Description
It was marked to be skipped with xdist in 4808145 (#4144 (comment)). The failure mentioned there (#4144 (comment)) appears to be different from the one below though.
assert leaked_types == 0
https://travis-ci.org/pytest-dev/pytest/jobs/451681349#L997
=================================== FAILURES ===================================
____________________ TestRequestBasic.test_request_garbage _____________________
self = <fixture.TestRequestBasic object at 0x7f2f9b626080>
testdir = <Testdir local('/tmp/pytest-of-travis/pytest-0/test_request_garbage0')>
@pytest.mark.skipif(
hasattr(sys, "pypy_version_info"),
reason="this method of test doesn't work on pypy",
)
def test_request_garbage(self, testdir):
try:
import xdist # noqa
except ImportError:
pass
else:
pytest.xfail("this test is flaky when executed with xdist")
testdir.makepyfile(
"""
import sys
import pytest
from _pytest.fixtures import PseudoFixtureDef
import gc
@pytest.fixture(autouse=True)
def something(request):
original = gc.get_debug()
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
yield
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
finally:
gc.set_debug(original)
def test_func():
pass
"""
)
result = testdir.runpytest()
> result.stdout.fnmatch_lines("* 1 passed in *")
E Failed: nomatch: '* 1 passed in *'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.7.1, pytest-3.10.1.dev17+g176d274, py-1.7.0, pluggy-0.8.0'
E and: "hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/travis/build/pytest-dev/pytest/.hypothesis/examples')"
E and: 'rootdir: /tmp/pytest-of-travis/pytest-0/test_request_garbage0, inifile:'
E and: 'plugins: hypothesis-3.82.1'
E and: 'collected 1 item'
E and: ''
E and: 'test_request_garbage.py .E [100%]'
E and: ''
E and: '==================================== ERRORS ===================================='
E and: '________________________ ERROR at teardown of test_func ________________________'
E and: ''
E and: "request = <SubRequest 'something' for <Function 'test_func'>>"
E and: ''
E and: ' @pytest.fixture(autouse=True)'
E and: ' def something(request):'
E and: ' original = gc.get_debug()'
E and: ' gc.set_debug(gc.DEBUG_SAVEALL)'
E and: ' gc.collect()'
E and: ' '
E and: ' yield'
E and: ' '
E and: ' try:'
E and: ' gc.collect()'
E and: ' leaked_types = sum(1 for _ in gc.garbage'
E and: ' if isinstance(_, PseudoFixtureDef))'
E and: ' '
E and: ' # debug leaked types if the test fails'
E and: ' print(leaked_types)'
E and: ' '
E and: ' gc.garbage[:] = []'
E and: ' '
E and: '> assert leaked_types == 0'
E and: 'E assert 4 == 0'
E and: ''
E and: 'test_request_garbage.py:24: AssertionError'
E and: '--------------------------- Captured stdout teardown ---------------------------'
E and: '4'
E and: '====================== 1 passed, 1 error in 0.62 seconds ======================='
E and: ''
E remains unmatched: '* 1 passed in *'
/home/travis/build/pytest-dev/pytest/testing/python/fixture.py:545: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.7.1, pytest-3.10.1.dev17+g176d274, py-1.7.0, pluggy-0.8.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/travis/build/pytest-dev/pytest/.hypothesis/examples')
rootdir: /tmp/pytest-of-travis/pytest-0/test_request_garbage0, inifile:
plugins: hypothesis-3.82.1
collected 1 item
test_request_garbage.py .E [100%]
==================================== ERRORS ====================================
________________________ ERROR at teardown of test_func ________________________
request = <SubRequest 'something' for <Function 'test_func'>>
@pytest.fixture(autouse=True)
def something(request):
original = gc.get_debug()
gc.set_debug(gc.DEBUG_SAVEALL)
gc.collect()
yield
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
E assert 4 == 0
test_request_garbage.py:24: AssertionError
--------------------------- Captured stdout teardown ---------------------------
4
====================== 1 passed, 1 error in 0.62 seconds =======================
=========================== short test summary info ============================
FAIL testing/python/fixture.py::TestRequestBasic::()::test_request_garbage
Metadata
Metadata
Assignees
Labels
type: bugproblem that needs to be addressedproblem that needs to be addressedtype: infrastructureimprovement to development/releases/CI structureimprovement to development/releases/CI structure