[0.3.0] Tests error/fail with asdf-3.0.0
Closed this issue · 5 comments
After upgrading the asdf package to 3.0.0, the unit tests errors with
ImportError while importing test module '/tmp/autopkgtest-lxc.ikfr6p4l/downtmp/build.W9D/src/tests/test_invalid.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
../build.W9D/src/tests/test_invalid.py:3: in <module>
from asdf.tests import helpers
E ModuleNotFoundError: No module named 'asdf.tests'
Full test log here.
Just replacing asdf.tests
with asdf.testing
makes all tests in test_invalid.py
fail:
_ test_failing_schema[\n !transform/shift-1.2.0\n offset: 1\n bounding_box: [1.0, test]\n ] _
yaml = '\n !transform/shift-1.2.0\n offset: 1\n bounding_box: [1.0, test]\n '
@pytest.mark.parametrize("yaml", purposefully_failing)
def test_failing_schema(yaml):
buff = helpers.yaml_to_asdf(f"example: {yaml.strip()}")
> with pytest.raises(asdf.ValidationError, match=r"Failed validating *"):
E Failed: DID NOT RAISE <class 'asdf._jsonschema.exceptions.ValidationError'>
tests/test_invalid.py:324: Failed
I didn't check the unreleased "main" branch. If this is supposed to be fixed: could I ask to make a new release then? Or can you point me to the fix?
Thanks for opening the issue.
I will make a release soon (0.4.0) (I need to run some rather slow tests on another package first). 0.4.0 will include all the changes in main including the update to test_invalid
to use asdf.testing
:
I was able to replicate the error you're seeing by not having asdf-astropy installed. asdf-astropy is only a test dependency. It's installed in the CI (which explains why the tests aren't failing there).
Thanks again for opening the detailed issue! I'll update this when the release is live on pypi.
Thank you for the hint! For the time being, I patched the asdf.testing
and added asdf-astropy to the test dependencies and everything works. This helps to get the new asdf version migrate to Debian testing soon.
Excellent!
0.4.0 is now available on pypi. I did some local testing (installing it, asdf 3.0 and asdf-astropy from pip) and saw passing tests. Let me know if this does or doesn't work for you.
Thanks again for opening the issue.
Thank you! This one works fine; I just uploaded the new version to Debian.
Thanks for letting me know and for packaging it!