--cov as final element in addopts creates confusing behaviour

Đang mở
#701 9 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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Start by reproducing the behavior with the shown pyproject.toml configuration and the commands pytest specific/file.py and pytest -s specific/file.py. Trace how the final --cov entry is combined with the selected test path; done means pytest specific/file.py runs only that file while coverage remains enabled.

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

Mô tả

Hi there,

I'm not sure this is a pytest bug but here it goes.

I have the following pyproject.toml configuration

[tool.pytest.ini_options]
testpaths = "test"
addopts = [
    "--import-mode=importlib",  # Recommended by pytest
    "--cov",
]

so I can easily use

pytest

to start my tests.

Now when I want to test only a specific file, doing

pytest specific/file.py

ignores the argument, while in the mean time, passing another optional argument such as the following

pytest -s specific/file.py

works perfectly as intended.

Am I missing a piece or is this a pytest-side problem?

Thanks in advance!

All the best.
Élie

Ngôn ngữ chính
Python
Star
2.1k
Fork
256
Merge trung bình
6 ngày 10 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

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 pytest-dev/pytest-cov

Tất cả issue của pytest-dev/pytest-cov

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.