Replies: 3 comments 2 replies
-
Further investigation shows that this is down to how the entry point is loaded. I'm note sure if the use of >>> import importlib_metadata
>>> for dist in list(importlib_metadata.distributions()):
... for ep in dist.entry_points:
... if ep.name.startswith('pytest_plugin'):
... print(ep)
... print(ep.load())
...
EntryPoint(name='pytest_plugin1', value='src.plugin', group='pytest11')
<module 'src.plugin' from '/home/user/pytest_plugins/pytest_plugin1/src/plugin.py'>
EntryPoint(name='pytest_plugin2', value='src.plugin', group='pytest11')
<module 'src.plugin' from '/home/user/pytest_plugins/pytest_plugin1/src/plugin.py'> |
Beta Was this translation helpful? Give feedback.
0 replies
-
All the plugins share the same module name ,thats bound to break, Different packages need different module top levels |
Beta Was this translation helpful? Give feedback.
2 replies
-
I was able to resolve my issue with here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am developing some plugins locally that I hope to one day publish, so I'm registering them using
setuptools
. As I'm only testing at the moment, to install them I'm using the--editable
option.If just either one of the plugins is installed,
pytest
works fine. In this case onlypytest_plugin2
is installed.However, if both are installed
pytest
fails. It looks as though both plugins are trying to read from the same path,'/home/user/pytest_plugins/pytest_plugin1/src/plugin.py
.I'm guessing this is somehow to do with how
pip
imports paths for--editable
installs, but I'm not totally sure. Is this a known issue with plugins, and if so is there a workaround?Example files
. ├─ pytest_plugins │ ├─ pytest_plugin1 │ │ ├─ src │ │ │ └─ plugin.py │ │ └─ setup.py │ └─ pytest_plugin2 │ ├─ src │ │ └─ plugin.py │ └─ setup.py └─ tests └─ test_something.py
pytest_plugins/pytest_plugin1/setup.py
pytest_plugins/pytest_plugin1/src/plugin.py
pytest_plugins/pytest_plugin2/setup.py
pytest_plugins/pytest_plugin2/src/plugin.py
tests/test_something
Beta Was this translation helpful? Give feedback.
All reactions