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
Hello! I am working on a project that needs to load plugins dynamically. I am making use of entrypoints and am trying to figure out what the best way is for making test plugins and having those test plugins be loaded only during my unit tests.
Some more context:
I have a function that will dynamically load entrypoints like so:
In my unit tests, I want to test that this is able to load my test plugins. I want to be able to do this dynamically via a pytest fixture where I can programmatically make an entrypoint to refer to my testing plugin, pass in the fake group name to my function above, and then have that entrypoint be cleaned up when the test is completed. Upon reviewing the documentation and looking at the code, I couldn't find any easy way to do this.
At the moment, the way that I was able to move forward was to add this entry to my pyproject.toml file, and passing in unit_test_plugins to my function above:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello! I am working on a project that needs to load plugins dynamically. I am making use of entrypoints and am trying to figure out what the best way is for making test plugins and having those test plugins be loaded only during my unit tests.
Some more context:
I have a function that will dynamically load entrypoints like so:
In my unit tests, I want to test that this is able to load my test plugins. I want to be able to do this dynamically via a pytest fixture where I can programmatically make an entrypoint to refer to my testing plugin, pass in the fake group name to my function above, and then have that entrypoint be cleaned up when the test is completed. Upon reviewing the documentation and looking at the code, I couldn't find any easy way to do this.
The closest I saw was this StackOverflow entry, which uses the old
pkg_resources
module: https://stackoverflow.com/a/48666503At the moment, the way that I was able to move forward was to add this entry to my
pyproject.toml
file, and passing inunit_test_plugins
to my function above:I would prefer to not have the entry above in my
pyproject.toml
and make it purely automatic with a fixture. Is there a way to do that?Thank You
Beta Was this translation helpful? Give feedback.
All reactions