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

Intermittent circular import error #379

Closed
Lilferrit opened this issue Sep 17, 2024 · 0 comments · Fixed by #380
Closed

Intermittent circular import error #379

Lilferrit opened this issue Sep 17, 2024 · 0 comments · Fixed by #380
Assignees
Labels
bug Something isn't working

Comments

@Lilferrit
Copy link
Contributor

The current dev branch has an intermittent circular import bug. A simple way to reproduce this bug is to run the command pytest tests\unit_tests\test_runner.py (this error doesn't occur in my local environment if all unit tests are ran at once), which then gives the output:

ImportError while importing test module 'C:\Users\gavin\OneDrive\Documents\casanovo\tests\unit_tests\test_runner.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
D:\anaconda3\envs\casanovo_env\lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\unit_tests\test_runner.py:8: in <module>
    from casanovo.config import Config
casanovo\config.py:11: in <module>
    from . import utils
casanovo\utils.py:18: in <module>
    from .data.ms_io import PepSpecMatch
casanovo\data\ms_io.py:15: in <module>
    from ..config import Config
E   ImportError: cannot import name 'Config' from partially initialized module 'casanovo.config' (most likely due to a circular import) (C:\Users\gavin\OneDrive\Documents\casanovo\casanovo\config.py)

This issue is resolved if the PepSpecMatch data class is moved to it's own file.

@Lilferrit Lilferrit added the bug Something isn't working label Sep 17, 2024
@Lilferrit Lilferrit self-assigned this Sep 17, 2024
@Lilferrit Lilferrit linked a pull request Sep 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant