pytest-dev / pytest-dev/pytest
Feature request - Add tab completion for test classes and functions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
Pytest can tab-complete for running individual files
pytest path_to/test_file.py
It would be great to extend the completion to classes and functions
pytest path_to/test_file.py::test_function
pytest path_to/test_file.py::TestClass::test_method
AFAICS it should be relatively straight forward to extend FastFilesCompleter for that. I may get around implemting this at some point.
Question: would it be ok for the completer to import the test_file.py or should we parse the contents via AST?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating FastFilesCompleter and tracing the existing pytest path completion behavior. Compare importing test_file.py with parsing it via AST, then verify completion for files, test functions, and TestClass::test_method using the existing completion test path, if present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100