Can I specify in-repo pytest plugins somehow for t...
# general
w
Can I specify in-repo pytest plugins somehow for the pytest sub-system? I have in
setup.cfg
Copy code
[tool:pytest]
...
addopts =
    -p amra.pytest.plugin.suites
When I run
./pants test
, the
amra.pytest.plugin.suites
module is not found, because it is not imported in the tests.
What I get right now is
Copy code
Traceback (most recent call last):
  File "~/.cache/pants/named_caches/pex_root/venvs/s/46cd174a/venv/lib/python3.10/site-packages/_pytest/config/__init__.py", line 743, in import_plugin
    __import__(importspec)
ModuleNotFoundError: No module named 'amra.pytest.plugin.suites'
for each test run
I could manually include the module, but we're talking A LOT of targets
Can
[pytest].extra_requirements
point to an in-repo address? 🤔 No, that goes via pip regardless of entry syntax
[tailor].alias_mapping
using a macro to include the plugin dependency might be what I'm looking for.
b
What we do is have a top-level
conftest.py
which declares
pytest_plugins
to be all the plugins we want. What you're seeing is pants has no way to infer the dependency. It can infer dependencies on conftest files, and I turn on "string import" dependency inference, so when it goes to infer deps of the conftest it sees the module name strings and adds deps for each module