tox-dev / pipdeptree

A command line utility to display dependency tree of the installed Python packages

Home Page:https://pypi.python.org/pypi/pipdeptree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test_package_dag_filter sometimes fails

mtelka opened this issue · comments

Testing of pipdeptree 2.9.4 revealed the test_package_dag_filter test sometimes fails. The test usually pass, but about every 10th test run shows failure like these:

___________________________ test_package_dag_filter ____________________________

    def test_package_dag_filter():
        # When both show_only and exclude are not specified, same tree
        assert t.filter_nodes(None, None) is t

        # when show_only is specified
        g1 = dag_to_dict(t.filter_nodes({"a", "d"}, None))
        expected = {"a": ["b", "c"], "b": ["d"], "c": ["d", "e"], "d": ["e"], "e": []}
>       assert expected == g1
E       AssertionError: assert {'a': ['b', '...': ['e'], ...} == {'a': ['b', '...': ['e'], ...}
E         Omitting 4 identical items, use -vv to show
E         Differing items:
E         {'c': ['d', 'e']} != {'c': ['e', 'd']}
E         Full diff:
E         - {'a': ['b', 'c'], 'b': ['d'], 'c': ['e', 'd'], 'd': ['e'], 'e': []}
E         ?                                        -----
E         + {'a': ['b', 'c'], 'b': ['d'], 'c': ['d', 'e'], 'd': ['e'], 'e': []}
E         ?                                     +++++

tests/test_pipdeptree.py:93: AssertionError

or

___________________________ test_package_dag_filter ____________________________ 
  
    def test_package_dag_filter():
        # When both show_only and exclude are not specified, same tree
        assert t.filter_nodes(None, None) is t
    
        # when show_only is specified
        g1 = dag_to_dict(t.filter_nodes({"a", "d"}, None))
        expected = {"a": ["b", "c"], "b": ["d"], "c": ["d", "e"], "d": ["e"], "e": []}
>       assert expected == g1
E       AssertionError: assert {'a': ['b', '...': ['e'], ...} == {'a': ['c', '...': ['e'], ...}
E         Omitting 3 identical items, use -vv to show
E         Differing items:
E         {'a': ['b', 'c']} != {'a': ['c', 'b']}
E         {'c': ['d', 'e']} != {'c': ['e', 'd']}
E         Full diff:
E         - {'a': ['c', 'b'], 'b': ['d'], 'c': ['e', 'd'], 'd': ['e'], 'e': []}
E         ?           -----                        -----
E         + {'a': ['b', 'c'], 'b': ['d'], 'c': ['d', 'e'], 'd': ['e'], 'e': []}
E         ?        +++++                        +++++

tests/test_pipdeptree.py:93: AssertionError

I run tests with the randomly pytest plugin installed so maybe it is related. Please note that this is the only test I see failed.

I just ran tests 50+ times successfully with the randomly plugin disabled. With the plugin enabled the test failed during 3rd run.