Ability to run single test methods or classes

Đang mở
#209 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
113
Fork
32
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của SublimeText/UnitTesting

Tất cả issue của SublimeText/UnitTesting

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.