Ability to run single test methods or classes
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at the unit_testing build target and its existing support for module patterns, using the build configuration for test_create_snippet_from_sel.py as the reference case. Trace how a pattern is passed to the test runner, then verify that pytest-style paths can select a test class and method as requested.
Written by the indexing model from the issue text.
Description
This is a common use case, supported both by unittest and pytest. E.g. in unittest I can run an individual test method with:
python3 -m unittest somelib.tests.test_process.TestProcess.test_kill
With pytest:
python3 -m pytest mylib/tests/test_process.py::TestProcess::test_kill
Apparently with UnitTesting it's possible to specify a single test module to run, but not a test class or a test method.
Right now I am running individual test modules by using this build config:
"build_systems": [
{
"name": "Sublime tests:",
"target": "unit_testing",
"package": "mypackage",
"variants": [
{"name": "test_create_snippet_from_sel.py", "pattern": "test_create_snippet_from_sel.py"},
]
}
I would like to be able to specify something like (mimicking pytest style):
{"name": "test_kill", "pattern": "test_create_snippet_from_sel.py::TestProcess::test_kill"},
To give even more context about my specific use case: I have a dynamic build system able to run individual test methods based on the cursor position (see ST forum post). I did this for both pytest and unittest. I would like to do the same by using UnitTesting.
@randy3k if you like the idea I can try working on a PR.
- Dominant language
- Python
- Stars
- 113
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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.
More from SublimeText/UnitTesting
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
SublimeText/UnitTesting#286 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
SublimeText/UnitTesting#276 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
SublimeText/UnitTesting#155 · 8 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
SublimeText/UnitTesting#31 · 5 comments ·