I'm trying to load a 1st party pytest plugin in a ...
# general
g
I'm trying to load a 1st party pytest plugin in a monorepo that gets loaded when running tests with pants. How can I do this?
w
Either
pytest
or the
python_tests
also has the option to include some dependencies/runtime dependencies... Would those be an alternative?
g
Using a 3rd party plugin posted to pypi (or really any artifact storage) is easy. I'm trying to use a first party that isn't published in a wheel.
I might just need to publish this as a wheel to workaround it.
Not the end of the world.
I'm not sure if it's enough to just have them in the
resolve
either? I've never made a first-party pytest plugin, but it looks like Pants maintains a ton of possible hooks
g
I'll try this out, thanks @wide-midnight-78598
👍 1
The main issue here is the registration of the plugin. I don't think pants / pex is doing anything here for that.
I added explicit dep and nothing happening. Again, because of the entry point piece. I don't know what if anything pex does for this.
w
Are you using pytest’s config? Or a pyproject as well?
h
Yeah, I don't think this is possible without publishing, but it's a good requirement to keep in mind for future improvements to the python backend
c
I got pytest's most basic plugin mode to work with a
python_test_utils
target and a mention in the pytest config: https://github.com/lilatomic/llamazure/commit/f086fb138a8b83328f1933bdfb42157f064054af , although I think it might just be working because of imports
👀 1
g
interesting you added
pytest_plugins
under
[tool.pytest.ini_options]
I'll have to give that a shot.
my issue is cross first party with multiple pyproject.toml though, but I'll give this a shot.
c
Did you ever figure out a satisfactory way to manage first party pytest plugins without publishing?
g
Nope! It sucks / painful.
c
Wrote this up as a feature request at: https://github.com/pantsbuild/pants/issues/21757