Run tests in a module discovery #12243
-
Hi all, Looking at the "Run tests in a module" section of the docs, it doesn't mention if the path to a module must be:
Can someone clarify the intended behavior? Perhaps this is something we can add explicit documentation for? My specific issue is with bullet 3 above, where I'm trying to pass a basename to pytest via
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
It works for absolute or relative paths. If it is not working for you it must be something else, please post a full example. |
Beta Was this translation helpful? Give feedback.
-
My folder structure looks like:
The contents of my
From the root of the folder, I want to run
where pytest can find a file with that base name under the configured test paths.
If I give pytest a relative path from my current directory (the root folder), it does successfully find the file:
|
Beta Was this translation helpful? Give feedback.
Not the filename directly (as @The-Compiler commented), but it is possible to use the
-k
flag (pytest -k basename
) and pytest will collect all files and run only those that containbasename
in their "node id".