-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Configuration option to "skip collection and testing entirely" to help support Monorepos #13321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think this is something pytest needs to solve. If you don't want to run pytest, just don't run pytest? I'm not aware of what
has a way to just not invoke |
The usecase is unclear The recommendation woul be to invoke pytest per project subfolder instead of doing a vatch all Id expect different subprojects to need different environment preparation, pytest plugins and possible local configurations So why is there a need to just run pytest randomly on all the things |
Thanks for the responses so far. To this:
I would like that way to come from pyproject.toml itself. That's is the short version of the ask. To this:
That part is handled effectively by I also haven't found any way to short circuit the process from inside a conftest.py. This would also work:
|
I suggest using a shell alias, so that you can run whatever logic you want to about whether to run pytest at all outside of Pytest. |
For any future testers, this was my workaround solution:
|
What's the problem this feature will solve?
In monorepo situtations [1] there can be top-level
pyproject.toml
files and workspaces that have no tests, and do not want test collection, or where test collection generates errors.Currently, when no tests are found, Pytest finishes with exit status 5, for good reasons. [2]
[1]:
nx run-many test
, etc.[2]: #2393
Describe the solution you'd like
An ini-able flag to disable all Pytest actions (test collection, test running, all of it), called
--do-nothing
, or--disable-pytest
or--no-collect
.Alternative Solutions
disable-pytest
a. Pytest plugin to change the exit code: https://pypi.org/project/pytest-custom-exit-code/
b.
norecursedirs =["*"]
, to ensure 0 tests are foundAdditional context
--disable-pytest
,--do-nothing
,--no-collect
?The text was updated successfully, but these errors were encountered: