Ability to run single test methods or classes

未关闭
#209 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
testing

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
113
派生
32
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SublimeText/UnitTesting 的其他 Issue

查看 SublimeText/UnitTesting 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。