Skip to content

Include pkg_resources test data in sdist#1991

Merged
jaraco merged 1 commit into
pypa:masterfrom
hroncok:manifest
Mar 7, 2020
Merged

Include pkg_resources test data in sdist#1991
jaraco merged 1 commit into
pypa:masterfrom
hroncok:manifest

Conversation

@hroncok

@hroncok hroncok commented Feb 11, 2020

Copy link
Copy Markdown
Contributor

This is the error otherwise:

_____________ TestFindDistributions.test_standalone_egg_directory ______________

self = <pkg_resources.tests.test_find_distributions.TestFindDistributions object at 0x7f17518a86d0>
target_dir = local('/tmp/pytest-of-mockbuild/pytest-0/test_standalone_egg_directory0/target')

    def test_standalone_egg_directory(self, target_dir):
        (TESTS_DATA_DIR / 'my-test-package_unpacked-egg').copy(target_dir)
        dists = pkg_resources.find_distributions(str(target_dir))
>       assert [dist.project_name for dist in dists] == ['my-test-package']
E       AssertionError: assert [] == ['my-test-package']
E         Right contains one more item: 'my-test-package'
E         Use -v to get the full diff

pkg_resources/tests/test_find_distributions.py:25: AssertionError
____________________ TestFindDistributions.test_zipped_egg _____________________

self = <module 'py.error'>, func = <built-in function listdir>
args = ('/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg',)
kwargs = {}, __tracebackhide__ = False, cls = <class 'py.error.ENOENT'>
value = FileNotFoundError(2, 'No such file or directory')
tb = <traceback object at 0x7f1751a6a7c0>, errno = 2

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
>           return func(*args, **kwargs)
E           FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg'

/usr/lib/python3.8/site-packages/py/_error.py:66: FileNotFoundError

During handling of the above exception, another exception occurred:

self = <pkg_resources.tests.test_find_distributions.TestFindDistributions object at 0x7f1751c8fe80>
target_dir = local('/tmp/pytest-of-mockbuild/pytest-0/test_zipped_egg0/target')

    def test_zipped_egg(self, target_dir):
>       (TESTS_DATA_DIR / 'my-test-package_zipped-egg').copy(target_dir)

pkg_resources/tests/test_find_distributions.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/py/_path/local.py:437: in copy
    for x in self.visit(rec=rec):
/usr/lib/python3.8/site-packages/py/_path/common.py:377: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/lib/python3.8/site-packages/py/_path/common.py:414: in gen
    entries = path.listdir()
/usr/lib/python3.8/site-packages/py/_path/local.py:392: in listdir
    names = py.error.checked_call(os.listdir, self.strpath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <module 'py.error'>, func = <built-in function listdir>
args = ('/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg',)
kwargs = {}, __tracebackhide__ = False, cls = <class 'py.error.ENOENT'>
value = FileNotFoundError(2, 'No such file or directory')
tb = <traceback object at 0x7f1751a6a7c0>, errno = 2

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
            return func(*args, **kwargs)
        except self.Error:
            raise
        except (OSError, EnvironmentError):
            cls, value, tb = sys.exc_info()
            if not hasattr(value, 'errno'):
                raise
            __tracebackhide__ = False
            errno = value.errno
            try:
                if not isinstance(value, WindowsError):
                    raise NameError
            except NameError:
                # we are not on Windows, or we got a proper OSError
                cls = self._geterrnoclass(errno)
            else:
                try:
                    cls = self._geterrnoclass(_winerrnomap[errno])
                except KeyError:
                    raise value
>           raise cls("%s%r" % (func.__name__, args))
E           py.error.ENOENT: [No such file or directory]: listdir('/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg',)

/usr/lib/python3.8/site-packages/py/_error.py:86: ENOENT

Pull Request Checklist

  • Changes have tests - no idea how
  • News fragment added in changelog.d

This is the error otherwise:

_____________ TestFindDistributions.test_standalone_egg_directory ______________

self = <pkg_resources.tests.test_find_distributions.TestFindDistributions object at 0x7f17518a86d0>
target_dir = local('/tmp/pytest-of-mockbuild/pytest-0/test_standalone_egg_directory0/target')

    def test_standalone_egg_directory(self, target_dir):
        (TESTS_DATA_DIR / 'my-test-package_unpacked-egg').copy(target_dir)
        dists = pkg_resources.find_distributions(str(target_dir))
>       assert [dist.project_name for dist in dists] == ['my-test-package']
E       AssertionError: assert [] == ['my-test-package']
E         Right contains one more item: 'my-test-package'
E         Use -v to get the full diff

pkg_resources/tests/test_find_distributions.py:25: AssertionError
____________________ TestFindDistributions.test_zipped_egg _____________________

self = <module 'py.error'>, func = <built-in function listdir>
args = ('/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg',)
kwargs = {}, __tracebackhide__ = False, cls = <class 'py.error.ENOENT'>
value = FileNotFoundError(2, 'No such file or directory')
tb = <traceback object at 0x7f1751a6a7c0>, errno = 2

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
>           return func(*args, **kwargs)
E           FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg'

/usr/lib/python3.8/site-packages/py/_error.py:66: FileNotFoundError

During handling of the above exception, another exception occurred:

self = <pkg_resources.tests.test_find_distributions.TestFindDistributions object at 0x7f1751c8fe80>
target_dir = local('/tmp/pytest-of-mockbuild/pytest-0/test_zipped_egg0/target')

    def test_zipped_egg(self, target_dir):
>       (TESTS_DATA_DIR / 'my-test-package_zipped-egg').copy(target_dir)

pkg_resources/tests/test_find_distributions.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/py/_path/local.py:437: in copy
    for x in self.visit(rec=rec):
/usr/lib/python3.8/site-packages/py/_path/common.py:377: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/lib/python3.8/site-packages/py/_path/common.py:414: in gen
    entries = path.listdir()
/usr/lib/python3.8/site-packages/py/_path/local.py:392: in listdir
    names = py.error.checked_call(os.listdir, self.strpath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <module 'py.error'>, func = <built-in function listdir>
args = ('/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg',)
kwargs = {}, __tracebackhide__ = False, cls = <class 'py.error.ENOENT'>
value = FileNotFoundError(2, 'No such file or directory')
tb = <traceback object at 0x7f1751a6a7c0>, errno = 2

    def checked_call(self, func, *args, **kwargs):
        """ call a function and raise an errno-exception if applicable. """
        __tracebackhide__ = True
        try:
            return func(*args, **kwargs)
        except self.Error:
            raise
        except (OSError, EnvironmentError):
            cls, value, tb = sys.exc_info()
            if not hasattr(value, 'errno'):
                raise
            __tracebackhide__ = False
            errno = value.errno
            try:
                if not isinstance(value, WindowsError):
                    raise NameError
            except NameError:
                # we are not on Windows, or we got a proper OSError
                cls = self._geterrnoclass(errno)
            else:
                try:
                    cls = self._geterrnoclass(_winerrnomap[errno])
                except KeyError:
                    raise value
>           raise cls("%s%r" % (func.__name__, args))
E           py.error.ENOENT: [No such file or directory]: listdir('/builddir/build/BUILD/setuptools-45.2.0/pkg_resources/tests/data/my-test-package_zipped-egg',)

/usr/lib/python3.8/site-packages/py/_error.py:86: ENOENT

@pganssle pganssle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for your contribution Miro!

We may want to consider a CI job run intermittently and required for release that builds an sdist and then runs the test suite from it, to avoid problems like this in the future, but that's a much bigger job than fixing the existing problem.

@hroncok

hroncok commented Feb 11, 2020

Copy link
Copy Markdown
Contributor Author

We may want to consider a CI job...

Shall I open a followup issue?

@pganssle

Copy link
Copy Markdown
Member

Shall I open a followup issue?

Sure, if you'd like.

@jaraco

jaraco commented Mar 7, 2020

Copy link
Copy Markdown
Member

Once this project can depend on pep518, it should be possible to rely on setuptools_scm, and problems like this one magically go away (if it's in the repo, it's in the sdist).

@jaraco jaraco merged commit 25edd19 into pypa:master Mar 7, 2020
@hroncok hroncok deleted the manifest branch October 24, 2022 23:47
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

Successfully merging this pull request may close these issues.

3 participants