-
$ poly check --strict
🔎 Is `e2e_test` needed in `e2e_test_base_project`?where The project does not import pytest_plugins = [
"ns.e2e_test",
]in Is there a way to suppress the |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
|
Hi @zed, is the component added as a brick in the project? If it's not used as a brick in the code then maybe it can be added to the project in a different way? This is how you can do it in Hatch. As an alternative, you could do an import of it in code, and silence the linter with an "ignore". |
Beta Was this translation helpful? Give feedback.
-
|
Yes, The traceback shows that pytest uses the ordinary builtin I've considered the explicit dummy I've tried: [tool.hatch.build.targets.sdist]
include = [
"../../components/ns/e2e_test/"
]but it does not include anything -- likely, because the path is outside the project root.
but it does not fix the import error unless is also present. It reintroduces the warning from As a workaround, I use the explicit import (no side-effects so far in my case): |
Beta Was this translation helpful? Give feedback.
-
|
I'll think about if there's a simple way to solve this with the tooling, I think your use case should be supported. Other: This should only happen when running the check command in |
Beta Was this translation helpful? Give feedback.
-
|
How do you run the tests, and how does the project fit in? I would like to reproduce this problem. I have the test dependencies in the root pyproject.toml, and run the tests in the virtual environment created for the repo root. If I understand it correctly, you have a Polylith project that contains tests? |
Beta Was this translation helpful? Give feedback.
-
|
There are 2 main ways to run the tests:
In both cases, the same command may be used (from different working directories): uv run python -m ns.e2e_test_baseIt picks up the desired venv automatically. There is no issue with importing There is import error if I've made a mistake in the previous comment. |
Beta Was this translation helpful? Give feedback.
-
|
Great that using |
Beta Was this translation helpful? Give feedback.
-
|
I was thinking about what can be done in the pytest files (such as from ns import e2e_test
pytest_plugins = [e2e_test.__name__] |
Beta Was this translation helpful? Give feedback.
-
|
At the moment, I've settled on keeping It makes both
I've might have been too hasty with the |
Beta Was this translation helpful? Give feedback.
-
|
Nice! I'll transfer this to a Q&A discussion, to keep it as documentation. |
Beta Was this translation helpful? Give feedback.
At the moment, I've settled on keeping
ns/e2e_testas a brick and modifyingconftest.py:It makes both
pytestandpoly checkhappy. No import at runtime -- no undesirable side-effects.e2e_test_base_projectcontinues to be dependent onns/e2e_testbrick (good).I've might have been too hasty with the
force-includeversion.uv build .packagesns/e2e_testfiles but it does not translate intoworking
uv run python -m ns.e2e_test_basecommand inprojects/e2e_test_base_projectdir in a clean environment (uv tool install-ed version works though).