Open kloczek opened 3 years ago
I get a different failure on Debian bookworm:
============================= test session starts ==============================
platform linux -- Python 3.11.2, pytest-7.2.1, pluggy-1.0.0+repack -- /usr/bin/python3.11
cachedir: .pytest_cache
rootdir: /build/yagot-0.5.0
collecting ... collected 93 items
tests/unittest/test_decorator.py::test_leaks_empty PASSED [ 1%]
tests/unittest/test_decorator.py::test_leaks_selfref_1 XFAIL [ 2%]
tests/unittest/test_decorator.py::test_leaks_selfref_2 PASSED [ 3%]
tests/unittest/test_decorator.py::test_leaks_selfref_3 PASSED [ 4%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_get_tracker PASSED [ 5%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_init PASSED [ 6%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_enable[kwargs0] PASSED [ 7%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_enable[kwargs1] PASSED [ 8%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_enable[kwargs2] PASSED [ 9%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_disable[True] PASSED [ 10%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_disable[False] PASSED [ 11%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_ignore[True] PASSED [ 12%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_ignore[False] PASSED [ 13%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-True-True-True] PASSED [ 15%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-True-True-False] PASSED [ 16%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-True-False-True] PASSED [ 17%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-True-False-False] PASSED [ 18%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-False-True-True] PASSED [ 19%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-False-True-False] PASSED [ 20%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-False-False-True] PASSED [ 21%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty test function-details0-False-False-False] PASSED [ 22%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-True-True-True] PASSED [ 23%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-True-True-False] PASSED [ 24%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-True-False-True] PASSED [ 25%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-True-False-False] PASSED [ 26%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-False-True-True] PASSED [ 27%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-False-True-False] PASSED [ 29%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-False-False-True] PASSED [ 30%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Standard dict with string-details1-False-False-False] PASSED [ 31%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-True-True-True] PASSED [ 32%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-True-True-False] PASSED [ 33%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-True-False-True] PASSED [ 34%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-True-False-False] PASSED [ 35%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-False-True-True] PASSED [ 36%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-False-True-False] PASSED [ 37%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-False-False-True] PASSED [ 38%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Empty OrderedDict creating garbage on Python 2.7-details2-False-False-False] PASSED [ 39%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-True-True-True] PASSED [ 40%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-True-True-False] PASSED [ 41%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-True-False-True] PASSED [ 43%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-True-False-False] PASSED [ 44%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-False-True-True] PASSED [ 45%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-False-True-False] PASSED [ 46%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-False-False-True] PASSED [ 47%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring no garbage-details3-False-False-False] PASSED [ 48%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-True-True-True] PASSED [ 49%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-True-True-False] PASSED [ 50%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-True-False-True] PASSED [ 51%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-True-False-False] PASSED [ 52%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-False-True-True] PASSED [ 53%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-False-True-False] PASSED [ 54%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-False-False-True] PASSED [ 55%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring incorrect 'list' type obj as garbage-details4-False-False-False] PASSED [ 56%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-True-True-True] PASSED [ 58%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-True-True-False] PASSED [ 59%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-True-False-True] PASSED [ 60%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-True-False-False] PASSED [ 61%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-False-True-True] PASSED [ 62%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-False-True-False] PASSED [ 63%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-False-False-True] PASSED [ 64%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type obj as garbage-details5-False-False-False] PASSED [ 65%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-True-True-True] PASSED [ 66%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-True-True-False] PASSED [ 67%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-True-False-True] PASSED [ 68%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-True-False-False] PASSED [ 69%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-False-True-True] PASSED [ 70%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-False-True-False] PASSED [ 72%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-False-False-True] PASSED [ 73%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[Self-referencing dict, ignoring correct 'dict' type name as garbage-details6-False-False-False] PASSED [ 74%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-True-True-True] PASSED [ 75%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-True-True-False] PASSED [ 76%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-True-False-True] PASSED [ 77%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-True-False-False] PASSED [ 78%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-False-True-True] PASSED [ 79%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-False-True-False] FAILED [ 80%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-False-False-True] PASSED [ 81%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-False-False-False] PASSED [ 82%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-True-True-True] PASSED [ 83%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-True-True-False] PASSED [ 84%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-True-False-True] PASSED [ 86%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-True-False-False] PASSED [ 87%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-False-True-True] PASSED [ 88%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-False-True-False] PASSED [ 89%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-False-False-True] PASSED [ 90%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type obj as garbage-details8-False-False-False] PASSED [ 91%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-True-True-True] PASSED [ 92%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-True-True-False] PASSED [ 93%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-True-False-True] PASSED [ 94%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-True-False-False] PASSED [ 95%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-False-True-True] PASSED [ 96%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-False-True-False] PASSED [ 97%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-False-False-True] PASSED [ 98%]
tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring correct 'SelfRef' type name as garbage-details9-False-False-False] PASSED [100%]
=================================== FAILURES ===================================
_ test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-False-True-False] _
desc = 'SelfRef class, ignoring no garbage'
details = {'exp_collected_types': [<class 'tests.unittest.test_decorator.SelfRef'>, <class 'dict'>], 'exp_uncollectable_types': [], 'func': <function func_class_selfref at 0x7fb08804e840>, 'ignore_types': None}
leaks_only = False, enable = True, ignore = False
@pytest.mark.parametrize(
"ignore", [True, False])
@pytest.mark.parametrize(
"enable", [True, False])
@pytest.mark.parametrize(
"leaks_only", [True, False])
@pytest.mark.parametrize(
"desc, details",
TESTCASES_GARBAGETRACKER_TRACK)
def test_GarbageTracker_track(desc, details, leaks_only, enable, ignore):
# pylint: disable=unused-argument
"""
Test function for tracking garbage using
GarbageTracker.start()/stop()/garbage.
"""
func = details['func']
ignore_types = details['ignore_types']
exp_collected_types = details['exp_collected_types']
exp_uncollectable_types = details['exp_uncollectable_types']
use_pdb = details.get('pdb', False)
if use_pdb:
import pdb # pylint: disable=import-outside-toplevel
pdb.set_trace()
obj = GarbageTracker()
if enable:
obj.enable(leaks_only)
obj.start()
func() # The code that might create leaks
if ignore:
obj.ignore()
if ignore_types is not None:
obj.ignore_types(ignore_types)
obj.stop()
if not enable:
# If the tracker was not enabled, we should not see any garbage
# reported.
assert obj.garbage == []
elif ignore:
# If the tracker was enabled but then ignored, we should also see no
# garbage reported.
assert obj.garbage == []
else:
# If the tracker was enabled and not ignored, we will see garbage
# reported (if there is expected garbage).
if leaks_only:
exp_garbage_types = exp_uncollectable_types
else:
exp_garbage_types = exp_collected_types
if isinstance(exp_garbage_types, int):
# We just check the number of objects
assert len(obj.garbage) == exp_garbage_types
else:
assert isinstance(exp_garbage_types, list)
# We check the types of the objects
garbage_types = [type(o) for o in obj.garbage]
> assert garbage_types == exp_garbage_types, \
"Garbage objects: {}".format(obj.garbage)
E AssertionError: Garbage objects: [<tests.unittest.test_decorator.SelfRef object at 0x7fb088044450>]
E assert [<class 'tests.unittest.test_decorator.SelfRef'>] == [<class 'tests.unittest.test_decorator.SelfRef'>, <class 'dict'>]
E Right contains one more item: <class 'dict'>
E Full diff:
E - [<class 'tests.unittest.test_decorator.SelfRef'>, <class 'dict'>]
E ? ----------------
E + [<class 'tests.unittest.test_decorator.SelfRef'>]
tests/unittest/test_garbagetracker.py:308: AssertionError
=========================== short test summary info ============================
FAILED tests/unittest/test_garbagetracker.py::test_GarbageTracker_track[SelfRef class, ignoring no garbage-details7-False-True-False]
=================== 1 failed, 91 passed, 1 xfailed in 0.44s ====================