You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a module in the /tasks directory with the same name as a package in site-packages, they will resolve to the same name because the /tasks directory was added to sys.path.
✗ inv -l
Traceback (most recent call last):
....
ImportError: cannot import name 'Testdir' from 'pytest'
If we look at sys.modules, we see:
'tasks.pytest': <module 'tasks.pytest' from '/invoke/integration/_support/package/tasks/pytest.py'>,
'pytest': <module 'pytest' from '/invoke/integration/_support/package/tasks/pytest.py'>}
Comparing 2.0 with 2.1.1, the main difference is sys.path.
2.0: /invoke/integration/_support/package is added
2.1.1: /invoke/integration/_support/package/tasks is added
If you have a submodule under tasks that has the same name as a top-level module, the import will fail.
For example, I have a module named common which is located in my site-packages.
My tasks directory looks like:
The issue is pretty simple,
https://github.com/pyinvoke/invoke/blob/main/invoke/loader.py#L77
import common
now comes from/project/tasks
instead of my site-packages.The text was updated successfully, but these errors were encountered: