bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
764 stars 304 forks source link

Cannot run individual tests when using "pytest" #6930

Open jpgxs opened 2 hours ago

jpgxs commented 2 hours ago

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 on python/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

jpgxs commented 2 hours ago

To add support for pytest, we would need to detect:

a. Test Classes: any class with name "Test" b. Test Methods: any method with name "test_" (possibly inside a test class) c. (for bonus points) Test Modules: any module with name "test_*"

(a) and (b) are relatively easy - not so sure about (c) though.

In any case, we would need to agree...