Closed christian-monch closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.41%. Comparing base (
c77087b
) to head (2d8d114
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I tested this locally and still have the same (or similar) issue:
python -m pytest -s -vv ../dlcatnewline/datalad_catalog/tests ✔ 9s datcattut ▓▒░
==================================================================== test session starts =====================================================================
platform darwin -- Python 3.11.7, pytest-8.2.1, pluggy-1.5.0 -- /Users/jsheunis/opt/miniconda3/envs/datcattut/bin/python
cachedir: .pytest_cache
rootdir: /Users/jsheunis/Documents/psyinf/dlcatnewline
configfile: pyproject.toml
plugins: cov-5.0.0
collecting ... [ERROR ] Internal error, cannot import interface 'datalad_catalog.create': ImportError(cannot import name 'CatalogRequired' from partially initialized module 'datalad_catalog.constraints' (most likely due to a circular import) (/Users/jsheunis/Documents/psyinf/dlcatnewline/datalad_catalog/constraints.py))
[ERROR ] Skipping unusable command interface 'datalad_catalog.create.Create' from extension 'catalog'
collected 51 items / 1 error
=========================================================================== ERRORS ===========================================================================
_____________________________________________________ ERROR collecting datalad_catalog/tests/test_add.py _____________________________________________________
../dlcatnewline/datalad_catalog/tests/test_add.py:5: in <module>
from datalad_catalog.add import Add
../dlcatnewline/datalad_catalog/add.py:11: in <module>
from datalad_catalog.constraints import (
../dlcatnewline/datalad_catalog/constraints.py:17: in <module>
from datalad_next.constraints import (
datalad_next/__init__.py:55: in <module>
import datalad_next.patches.enabled
datalad_next/patches/enabled.py:1: in <module>
from . import (
datalad_next/patches/patch_ria_ora.py:25: in <module>
from . import fix_ria_ora_tests
datalad_next/patches/fix_ria_ora_tests.py:937: in <module>
apply_patch(
datalad_next/patches/__init__.py:60: in apply_patch
mod = import_module(modname, package='datalad')
../../../opt/miniconda3/envs/datcattut/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
???
<frozen importlib._bootstrap>:1176: in _find_and_load
???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:690: in _load_unlocked
???
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
exec(co, module.__dict__)
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/core/distributed/tests/test_clone.py:20: in <module>
from datalad.api import (
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/api.py:74: in <module>
_generate_extension_api()
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/api.py:59: in _generate_extension_api
intf = load_interface(intfspec[:2])
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/interface/base.py:168: in load_interface
intf = getattr(mod, spec[1])
E AttributeError: partially initialized module 'datalad_catalog.add' has no attribute 'Add' (most likely due to a circular import)
Can you confirm this with v1.4.1?
Confirmed, locally
I tested this locally and still have the same (or similar) issue: [...]
I tested locally as well and all tests passed. My configuration:
fix-circular-import
from https://github.com/christian-monch/datalad-next)What is your configuration on the failing tests?
looks like the main difference is the datalad-catalog
version, i'm at datalad_catalog-1.1.1+66.g55ef5e5
looks like the main difference is the
datalad-catalog
version, i'm atdatalad_catalog-1.1.1+66.g55ef5e5
I updated my datalad-catalog version to 1.1.1+67.g76bb8d9. I still get passing tests from ./datalad_catalog/tests/test_add.py
with datalad-next 1.4.1 and with the fix-circular-import
-branch and failing tests with datalad-next 1.4.0.
I checked all versions again now, and couldn't find a difference to your setup, apart from the system.
I ran the tests again and still received the circular import error.
I checked all versions again now, and couldn't find a difference to your setup, apart from the system.
I ran the tests again and still received the circular import error. [...]
Thanks for testing that. I will later check on my OSX machine.
Do you have an editable installation of datalad-next? Can you post the output of pip list|grep datalad
?
Do you have an editable installation of datalad-next?
Yes, from your PR branch
Can you post the output of pip list|grep datalad?
datalad 1.0.2
datalad_catalog 1.1.1+67.g76bb8d9 /Users/jsheunis/Documents/psyinf/dlcatnewline
datalad-deprecated 0.3.0
datalad-metadata-model 0.3.11
datalad_metalad 0.4.22
datalad_next 1.4.1+21.g77dc151 /Users/jsheunis/Documents/psyinf/datalad-next
After running the above, I ran the tests again and I get:
>> python -m pytest -s -vv ../dlcatnewline/datalad_catalog/tests/test_add.py
==================================================================== test session starts =====================================================================
platform darwin -- Python 3.11.7, pytest-8.2.1, pluggy-1.5.0 -- /Users/jsheunis/opt/miniconda3/envs/datcattut/bin/python
cachedir: .pytest_cache
rootdir: /Users/jsheunis/Documents/psyinf/dlcatnewline
configfile: pyproject.toml
plugins: cov-5.0.0
collecting ... [ERROR ] Internal error, cannot import interface 'datalad_catalog.create': ImportError(cannot import name 'CatalogRequired' from partially initialized module 'datalad_catalog.constraints' (most likely due to a circular import) (/Users/jsheunis/Documents/psyinf/dlcatnewline/datalad_catalog/constraints.py))
[ERROR ] Skipping unusable command interface 'datalad_catalog.create.Create' from extension 'catalog'
collected 0 items / 1 error
=========================================================================== ERRORS ===========================================================================
_____________________________________________________ ERROR collecting datalad_catalog/tests/test_add.py _____________________________________________________
../dlcatnewline/datalad_catalog/tests/test_add.py:5: in <module>
from datalad_catalog.add import Add
../dlcatnewline/datalad_catalog/add.py:11: in <module>
from datalad_catalog.constraints import (
../dlcatnewline/datalad_catalog/constraints.py:17: in <module>
from datalad_next.constraints import (
datalad_next/__init__.py:55: in <module>
import datalad_next.patches.enabled
datalad_next/patches/enabled.py:1: in <module>
from . import (
datalad_next/patches/patch_ria_ora.py:25: in <module>
from . import fix_ria_ora_tests
datalad_next/patches/fix_ria_ora_tests.py:937: in <module>
apply_patch(
datalad_next/patches/__init__.py:60: in apply_patch
mod = import_module(modname, package='datalad')
../../../opt/miniconda3/envs/datcattut/lib/python3.11/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
???
<frozen importlib._bootstrap>:1176: in _find_and_load
???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:690: in _load_unlocked
???
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
exec(co, module.__dict__)
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/core/distributed/tests/test_clone.py:20: in <module>
from datalad.api import (
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/api.py:74: in <module>
_generate_extension_api()
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/api.py:59: in _generate_extension_api
intf = load_interface(intfspec[:2])
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/interface/base.py:168: in load_interface
intf = getattr(mod, spec[1])
E AttributeError: partially initialized module 'datalad_catalog.add' has no attribute 'Add' (most likely due to a circular import)
====================================================================== warnings summary ======================================================================
../dlcatnewline/datalad_catalog/webcatalog.py:5
../dlcatnewline/datalad_catalog/webcatalog.py:5
/Users/jsheunis/Documents/psyinf/dlcatnewline/datalad_catalog/webcatalog.py:5: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
from jsonschema import (
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/tests/utils_pytest.py:76
/Users/jsheunis/opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/tests/utils_pytest.py:76: PytestUnknownMarkWarning: Unknown pytest.mark.serve_path_via_http - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
return getattr(pytest.mark, name)
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/tests/utils_pytest.py:76
/Users/jsheunis/opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/datalad/tests/utils_pytest.py:76: PytestUnknownMarkWarning: Unknown pytest.mark.skip_if_adjusted_branch - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
return getattr(pytest.mark, name)
../../../opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/boto/plugin.py:40
/Users/jsheunis/opt/miniconda3/envs/datcattut/lib/python3.11/site-packages/boto/plugin.py:40: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================== short test summary info ===================================================================
ERROR ../dlcatnewline/datalad_catalog/tests/test_add.py - AttributeError: partially initialized module 'datalad_catalog.add' has no attribute 'Add' (most likely due to a circular import)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================ 5 warnings, 1 error in 1.22s ================================================================
Can you try with a non-editable installation of datalad-next (and maybe of datalad-catalog)?
I did that. Uninstalled the existing editable install and installed 1.4.1 via pip, same problem.
Fixed by PR #717
This PR aims at fixing an error in tests that appeared in
datalad-catalog
after release 1.4 ofdatalad-next
.