pkgcore/snakeoil

'setup.py test' fails to find snakeoil.dist

mgorny opened this issue · 0 comments

________________________________________________________ Test_modules.test__all__accuracy _________________________________________________________

namespace = 'snakeoil.dist', existance_check = False

    @staticmethod
    def poor_mans_load(namespace, existance_check=False):
        try:
            obj = __import__(namespace)
            if existance_check:
                return True
        except:
            if existance_check:
                return False
            raise
        for chunk in namespace.split(".")[1:]:
            try:
>               obj = getattr(obj, chunk)
E               AttributeError: module 'snakeoil' has no attribute 'dist'

snakeoil/test/mixins.py:166: AttributeError

During handling of the above exception, another exception occurred:

self = <test_source_hygene.Test_modules object at 0x7f8e311be2e8>

    def test__all__accuracy(self):
        failures = []
>       for module in self.walk_namespace(self.target_namespace):

snakeoil/test/modules.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
snakeoil/test/mixins.py:100: in get_modules
    yield self.poor_mans_load(namespace)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

namespace = 'snakeoil.dist', existance_check = False

    @staticmethod
    def poor_mans_load(namespace, existance_check=False):
        try:
            obj = __import__(namespace)
            if existance_check:
                return True
        except:
            if existance_check:
                return False
            raise
        for chunk in namespace.split(".")[1:]:
            try:
                obj = getattr(obj, chunk)
            except IGNORED_EXCEPTIONS:
                raise
            except AttributeError:
>               raise AssertionError("failed importing target %s" % namespace)
E               AssertionError: failed importing target snakeoil.dist

snakeoil/test/mixins.py:170: AssertionError
===Flaky Test Report===


===End Flaky Test Report===
=============================================== 11 failed, 468 passed, 56 skipped in 35.61 seconds ================================================

and alike. I suspect it has something to do with setup.py loading that module before starting pytest. It causes the ebuild to fail; I can reproduce it with plain python3.6 setup.py test as well. Calling pytest -vv directly seems to work fine though, so maybe ebuild could be changed while this is broken.

Oh, and uninstalling system snakeoil doesn't help.