['/home/n/importhell/metabot.calendars.google',
'/home/n/importhell/metabot.calendars.google/.venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages']
<module 'metabot' from '/home/n/importhell/metabot.calendars.google/metabot/__init__.py'>
<module 'metabot.calendars' from '/home/n/importhell/metabot.calendars.google/metabot/calendars/__init__.py'>
<module 'metabot.calendars.base' from '/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages/metabot/calendars/base.py'>
<module 'metabot.calendars.google' from '/home/n/importhell/metabot.calendars.google/metabot/calendars/google.py'>
E assert 0
ls -d .venv/lib/python3.10/site-packages/*metabot*
['/home/n/importhell/metabot.calendars.google',
'/home/n/importhell/metabot.calendars.google/.venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages']
<module 'metabot' from '/home/n/importhell/metabot.calendars.google/metabot/__init__.py'>
<module 'metabot.calendars' from '/home/n/importhell/metabot.calendars.google/metabot/calendars/__init__.py'>
E ImportError: cannot import name 'base' from 'metabot.calendars' (/home/n/importhell/metabot.calendars.google/metabot/calendars/__init__.py)
ls -d .venv/lib/python3.10/site-packages/*metabot*
['/home/n/importhell/metabot.calendars.google/metabot/calendars',
'/home/n/importhell/metabot.calendars.google/.venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages',
'__editable__.metabot-0.3.20.1.finder.__path_hook__',
'__editable__.metabot.calendars.google-0.2.finder.__path_hook__']
<module 'metabot' (<_frozen_importlib_external._NamespaceLoader object at 0x7efb542c1450>)>
<module 'metabot.calendars' (<_frozen_importlib_external._NamespaceLoader object at 0x7efb542c13f0>)>
E ModuleNotFoundError: No module named 'google.api_core'; 'google' is not a package
(This is because import google.api_core is now attempting to import api_core from /home/n/importhell/metabot.calendars.google/metabot/calendars/google.py!)
pytest --import-mode=append
['/home/n/importhell/metabot.calendars.google/.venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages',
'__editable__.metabot-0.3.20.1.finder.__path_hook__',
'__editable__.metabot.calendars.google-0.2.finder.__path_hook__',
'/home/n/importhell/metabot.calendars.google/metabot/calendars']
<module 'metabot' (<_frozen_importlib_external._NamespaceLoader object at 0x7310511694b0>)>
<module 'metabot.calendars' (<_frozen_importlib_external._NamespaceLoader object at 0x731051169570>)>
E ModuleNotFoundError: No module named 'google.api_core'; 'google' is not a package
(/home/n/importhell/metabot.calendars.google/metabot/calendars/google.py is still taking precedence over /home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages/google/.)
pytest --import-mode=importlib
ERROR collecting metabot/calendars/test_google.py
.venv/lib/python3.10/site-packages/__editable___metabot_0_3_20_1_finder.py:27: in find_spec
return PathFinder.find_spec(fullname, path=[MAPPING[parent]])
<frozen importlib._bootstrap_external>:1448: in find_spec
???
<frozen importlib._bootstrap_external>:1222: in __init__
???
<frozen importlib._bootstrap_external>:1238: in _get_parent_path
???
E KeyError: 'metabot'
(No idea what's going on here.)
pytest -o consider_namespace_packages=true
['/home/n/importhell/metabot.calendars.google',
'/home/n/importhell/metabot.calendars.google/.venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages',
'__editable__.metabot-0.3.20.1.finder.__path_hook__',
'__editable__.metabot.calendars.google-0.2.finder.__path_hook__']
<module 'metabot' (<_frozen_importlib_external._NamespaceLoader object at 0x78ca84fecd60>)>
<module 'metabot.calendars' (<_frozen_importlib_external._NamespaceLoader object at 0x78ca84fecfa0>)>
<module 'metabot.calendars.base' from '/home/n/importhell/metabot/metabot/calendars/base.py'>
<module 'metabot.calendars.google' from '/home/n/importhell/metabot.calendars.google/metabot/calendars/google.py'>
E assert 0
See #53.
Holy hell this was an odyssey.
(This is because
import google.api_core
is now attempting to importapi_core
from/home/n/importhell/metabot.calendars.google/metabot/calendars/google.py
!)(
/home/n/importhell/metabot.calendars.google/metabot/calendars/google.py
is still taking precedence over/home/n/importhell/metabot.calendars.google/.venv/lib/python3.10/site-packages/google/
.)(No idea what's going on here.)
Thank you to https://github.com/pytest-dev/pytest/issues/2371#issuecomment-2021330057.