Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestDepends.testRequire regression in 41.6.0 (py3) #1896

Closed
mgorny opened this issue Oct 30, 2019 · 7 comments
Closed

TestDepends.testRequire regression in 41.6.0 (py3) #1896

mgorny opened this issue Oct 30, 2019 · 7 comments

Comments

@mgorny
Copy link
Contributor

mgorny commented Oct 30, 2019

While trying to build the new release of setuptools, I get the following test failure:

==================================================================== FAILURES =====================================================================
_____________________________________________________________ TestDepends.testRequire _____________________________________________________________

self = <setuptools.tests.test_setuptools.TestDepends object at 0x7fbfae31d710>

    @needs_bytecode
    def testRequire(self):
        req = Require('Json', '1.0.3', 'json')
    
        assert req.name == 'Json'
        assert req.module == 'json'
        assert req.requested_version == '1.0.3'
        assert req.attribute == '__version__'
        assert req.full_name() == 'Json-1.0.3'
    
        from json import __version__
        assert req.get_version() == __version__
        assert req.version_ok('1.0.9')
        assert not req.version_ok('0.9.1')
        assert not req.version_ok('unknown')
    
        assert req.is_present()
        assert req.is_current()
    
        req = Require('Json 3000', '03000', 'json', format=LooseVersion)
        assert req.is_present()
        assert not req.is_current()
        assert not req.version_ok('unknown')
    
        req = Require('Do-what-I-mean', '1.0', 'd-w-i-m')
        assert not req.is_present()
        assert not req.is_current()
    
        req = Require('Tests', None, 'tests', homepage="http://example.com")
        assert req.format is None
        assert req.attribute is None
        assert req.requested_version is None
        assert req.full_name() == 'Tests'
        assert req.homepage == 'http://example.com'
    
        from setuptools.tests import __path__
        paths = [os.path.dirname(p) for p in __path__]
>       assert req.is_present(paths)
E       AssertionError: assert False
E        +  where False = <bound method Require.is_present of <setuptools.depends.Require object at 0x7fbfae0d0b38>>(['/tmp/portage/dev-python/setuptools-41.6.0/work/setuptools-41.6.0-python3_5/setuptools'])
E        +    where <bound method Require.is_present of <setuptools.depends.Require object at 0x7fbfae0d0b38>> = <setuptools.depends.Require object at 0x7fbfae0d0b38>.is_present

setuptools/tests/test_setuptools.py:120: AssertionError

I can reproduce it reliably with at least pypy3.6 (7.2.0) & python3.5 (3.5.7). I haven't tested other versions yet.

Full build log: dev-python:setuptools-41.6.0:20191030-083347.log

@mgorny
Copy link
Contributor Author

mgorny commented Oct 30, 2019

In 41.5.1 all tests pass.

@torsava
Copy link
Contributor

torsava commented Nov 6, 2019

We have the same problem when trying to update to the new release in Fedora.

@torsava
Copy link
Contributor

torsava commented Nov 6, 2019

I have checked that paths are equivalent on both versions:

Old, 41.5.1:

DEBUG: __path__ = ['/builddir/build/BUILD/setuptools-41.5.1/setuptools/tests']
DEBUG: paths = ['/builddir/build/BUILD/setuptools-41.5.1/setuptools']

New, 41.6.0:

DEBUG: __path__ = ['/builddir/build/BUILD/setuptools-41.6.0/setuptools/tests']
DEBUG: paths = ['/builddir/build/BUILD/setuptools-41.6.0/setuptools']

Yet the test passes on 41.5.1 and fails on 41.6.0.

@mimi1vx
Copy link
Contributor

mimi1vx commented Nov 14, 2019

looks like this part is buggy:

https://github.com/pypa/setuptools/blob/master/setuptools/_imp.py#L22-L24

imp.find_module(self.module, paths)
(None, '/home/abuild/rpmbuild/BUILD/setuptools-41.6.0/setuptools/tests', ('', '', 5))

but importlib.findspec(self.module, paths) returns None and throws Importerror

And documentation says:

If the module is a package, file is None, pathname is the package path and the last item in the description tuple is PKG_DIRECTORY.

and even worse importlib.util.find_spec parameters are name and package , not list of paths

@jaraco
Copy link
Member

jaraco commented Jan 19, 2020

Thank you for this report. I stumbled on this issue today when I tried to remove the ./tests/ directory from the repo. Apparently, the presence of that directory masks this error for the CI runs or other runs from the repo.

@mgorny
Copy link
Contributor Author

mgorny commented Jan 19, 2020

For the record, the solution from #1905 works for me and we're (Gentoo) carrying it for a few releases now.

@jaraco
Copy link
Member

jaraco commented Jan 19, 2020

It's somewhat surprising to me that no users complained about this regression. Apparently the test suite is guaranteeing behavior that no one uses.

@jaraco jaraco closed this as completed in bbf825e Jan 19, 2020
jaraco added a commit that referenced this issue Jan 20, 2020
karelyatin pushed a commit to rdo-common/python-setuptools that referenced this issue Feb 5, 2020
JasenChao pushed a commit to fedora-riscv/python-setuptools that referenced this issue Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants