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

[2.7.1] Test Errors with Python 3.9 #887

Closed
olebole opened this issue Nov 24, 2020 · 3 comments
Closed

[2.7.1] Test Errors with Python 3.9 #887

olebole opened this issue Nov 24, 2020 · 3 comments
Milestone

Comments

@olebole
Copy link
Contributor

olebole commented Nov 24, 2020

Hi,

on Debian, we are currently migrating to Python 3.9. With the released version, we get now errors when running the tests:

============================= test session starts ==============================
platform linux -- Python 3.9.0+, pytest-4.6.11, py-1.9.0, pluggy-0.13.0
rootdir: /tmp/autopkgtest-lxc.dhe2dv4q/downtmp/autopkgtest_tmp
plugins: openfiles-0.5.0, arraydiff-0.3, hypothesis-5.41.2, remotedata-0.3.2,
asdf-2.7.1, astropy-header-0.1.2, doctestplus-0.7.0, filter-subpackage-0.1.1,
cov-2.8.1
collected 462 items / 2 errors / 460 selected

==================================== ERRORS ====================================
_______________ ERROR collecting tags/core/tests/test_ndarray.py _______________
/usr/lib/python3/dist-packages/asdf/tags/core/tests/test_ndarray.py:25: in <module>
    TEST_DATA_PATH = helpers.get_test_data_path('', module=test_data)
/usr/lib/python3/dist-packages/asdf/tests/helpers.py:68: in get_test_data_path
    with resources.path(module, name) as path:
/usr/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
/usr/lib/python3.9/importlib/resources.py:175: in _path_from_reader
    opener_reader = reader.open_resource(norm_resource)
<frozen importlib._bootstrap_external>:995: in open_resource
    ???
E   IsADirectoryError: [Errno 21] Is a directory:
'/usr/lib/python3/dist-packages/asdf/tags/core/tests/data'
_____________________ ERROR collecting tests/test_types.py _____________________
/usr/lib/python3/dist-packages/asdf/tests/test_types.py:20: in <module>
    TEST_DATA_PATH = str(helpers.get_test_data_path(''))
/usr/lib/python3/dist-packages/asdf/tests/helpers.py:68: in get_test_data_path
    with resources.path(module, name) as path:
/usr/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
/usr/lib/python3.9/importlib/resources.py:175: in _path_from_reader
    opener_reader = reader.open_resource(norm_resource)
<frozen importlib._bootstrap_external>:995: in open_resource
    ???
E   IsADirectoryError: [Errno 21] Is a directory:
'/usr/lib/python3/dist-packages/asdf/tests/data'
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 2 error in 1.59 seconds ============================

This was reported as bug Debian#975529. With Python 3.8, the tests run fine. Do you have a patch available that fixes this? Or do you plan a new version soon?

@eslavich
Copy link
Contributor

I ran our test suite on a Travis linux container with Python 3.9 and didn't see any failures. Here's the result when running the tests out of the repo clone:

https://travis-ci.com/github/asdf-format/asdf/jobs/446366394

and from the installed package with pytest --pyargs asdf:

https://travis-ci.com/github/asdf-format/asdf/jobs/446366410

I don't know why Debian behaves differently, but looking at the documentation for importlib.resources.path it seems clear that we're misusing it by asking for a directory.

@jdavies-st
Copy link
Contributor

I suspect that helpers.get_test_data_path should just be removed. Or just return a path instead of returning the opened file in a with context manager.

@eslavich
Copy link
Contributor

Resolved by #889

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

3 participants