Open JosephTLyons opened 3 months ago
After thinking about it, it seems like we should bake unittest
testing into the zed python crate, since its part of the standard lib, and then offer pytest
testing via an extension, since its a 3rd-party python package.
@JosephTLyons Should pytest
be in an extension or could it be added to the current implementation of @rayduck ?
I think in python pytest
is the defacto solutions to testing.
A python user is likely to go for pytest
as the test runner instead of unittest
, hence pytest
support should be built-in to the python crate, just like how the non-standard lib pyright LSP is included.
Ideally, zed checks the project's venv for the presence of pytest
(perhaps looking at pyproject.toml
) and if found, runs that particular pytest
so any plugin or user config is preserved. Otherwise, fallback to unittest
support.
What I think may be missing is (1) using different test discovery rules (i.e what's in runnables.scm
) conditionally or having additional tags like @run-pytest
that somehow would not show up in the UI when pytest is not available (pytest's discovery ruleset is a superset of unittest's). @osiewicz do you reckon this is possible today?
Less importantly, (2) a solid detection of venv or conda envs (in the meantime, just let users specify a local config for which test runner to use).
Yep, we can now adjust tasks to "fit" user system configuration (e.g. installed test runners and so on). Looking at the venv may be a bit tricky, but doable
+1 to adding pytest support! It would also be nice to be able to debug a test in the IDE
oh damn! i'm ready to use zed in production today! give me pytest plz to be honest i don't know a single living person on this planet who uses unittest (qa) in python FYI @JosephTLyons
FYI @JosephTLyons @osiewicz Please, don't forget. Proszę, nie zapomnijcie.
Check for existing issues
Describe the feature
There are a load of python testing frameworks, but of those, the most popular are:
unittest
- Python's stdlib testing frameworkpytest
- 3rd party, but likely the most-used testing frameworkIt would be great if we could offer testing support for both
unittest
andpytest
, as I think that would cover most users. We should include commands to run all tests, for both frameworks, and to discover and run single tests, for both frameworks. All that being said, I'm not sure if our task infrastructure is really set up to handle being able to run tests from different testing frameworks. @osiewicz would know more.Honorable mentions for Python testing frameworks go to ward - its modern, neat, and then one I reach for these days.
If applicable, add mockups / screenshots to help present your vision of the feature
No response