Trim "mypy/tests/testX.py::XDataSuite::" from test items
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
We can rewrite test collection so that e.g. test-data/unit/check-abstract.test is deemed the test node, rather than mypy/test/testcheck.py::CheckTestSuite::check-abstract.test. This would improve the ergonomics of test invocation, so that one could simply invoke e.g.
pytest test-data/unit/check-abstract.test
Technically, we'd follow the recipe in Working with non-python tests. Each data suite would implement a pytest_collect_file. However, it would also mean we'd need a "registry" of all data suites, since the collection mechanism would need to "ask" all data suites whether they handle the file (in some cases, multiple data suites could each emit items for the same file & test -- see test_name_suffix).
The non-data-suite tests (e.g. those deriving from TestCase) would remain unaffected.
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 with the collection path for mypy/test/testcheck.py::CheckTestSuite::check-abstract.test and the data file test-data/unit/check-abstract.test. Read pytest's Working with non-python tests recipe, then trace how data suites and test_name_suffix currently identify items. Done means pytest can invoke the data file directly while non-data-suite TestCase tests remain unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100