-
Notifications
You must be signed in to change notification settings - Fork 305
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
Cannot run individual tests when using "pytest" #6930
Comments
To add support for pytest, we would need to detect: a. Test Classes: any class with name "Test*" (a) and (b) are relatively easy - not so sure about (c) though. In any case, we would need to agree...
|
Hi @jpgxs Having said that. When running an "individual test" it ends up running all test tests in that target (I'm not sure if this is expected behaviour or a bug). A question to the maintainers, is there a reason something like the following isn't passed? |
Thanks @JeroenSchmidt, I seem to get some interesting behaviour now that I'm looking closely. If I define a test at the module level (not inside a class), I get the same behaviour as you: However, for test classes (
It's not clear to me why (1) happens as it seems to have changed over the course of today; I think it's related to IntelliJ's native pytest integration + caching. Currently, I get "Nothing Here" for all tests in the file: This changes in all cases if I either: (a) Define a test at the module level: (b) Define a test class with name "*Test": I think this logic is being handled here:
Of course, these aren't very useful if they run all the tests in the suite anyway; some of our py_test targets take 10+ minutes to run if you're running everything! The unittest integration seems to pass though the For pytest, I think it should either: a. Pass it through with exactly the same scheme as unittest. Personally, I'm leaning towards (b) but it might be a bit trickier |
Description of the feature request:
When using pytest, there are no play icons▶️ for running individual tests (individual methods, classes, modules) using Bazel.
It appears that only
unittest.TestCase
is supported, based onpython/src/com/google/idea/blaze/python/run/PyTestUtils.java
.I'm happy to submit a PR for this if we can agree on the implementation.
Which category does this issue belong to?
Intellij, PyCharm
What underlying problem are you trying to solve with this feature?
Want to run run filtered pytest tests from the IntelliJ/PyCharm editor
What operating system, Intellij IDE and programming languages are you using? Please provide specific versions.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: