exercism / exercism/python-test-runner

Find a way to filter concept exercises by taskno from the command line (concept exercises)

Đang mở
#87 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
13
Fork
20
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,
Pytest test suites in Exercism contain custom marks in the form of `@pytest.mark.task(taskno=X)` where X is a whole number. At least in concept exercises, this number corresponds to the task inside the supplied README file.
While doing a concept exercise, I wanted to select pytest tests to run and filter them by this `taskno` parameter but failed to do so. What I tried:
1) @BethanyG sent me a [link to StackOverflow thread which shows one similar problem](https://stackoverflow.com/questions/67200501/pytest-run-only-tests-with-specific-marker-attribute):

However, the example code allows to run marks with arguments looking like this:
`@pytest.mark.task("taskno1")`

Perhaps there is a way to modify something in the conftest functions but I haven't wrapped my head around it.

2) I tried a plugin called [pytest-pilot](https://smarie.github.io/python-pytest-pilot/)

It supplies easier syntax for solving similar problems as `1` but also didn't help me solve the problem. I would get an error `IndexError: tuple index out of range`.

What I use now:
1) `pytest -k keyword_you_need`
It usually works, but sometimes I still select more of fewer tests than needed
2) `pytest --tb=short`
I don't like long error messages from pytests so this is another way to limit pytest from adding too much unwanted output.

Filtering by task number would be "nice to have", but I think solving this problem is interesting in itself. All help is welcome :)

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

Đánh giá

Issue này chưa được đánh giá.

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.