Tests that importorskip('petab') skip when petab is installed but broken, so a broken petab passes CI as skipped tests

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

Maintainer thường phản hồi trong vòng 1 ngày

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
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
testing

Hướng nghiên cứu

Start by reading tests/conftest.py and the seven tutorial test modules updated for #1028, then locate the remaining pytest.importorskip('petab') calls across the 20 test files. Check that tests skip only when petab is absent and fail when an installed petab raises an import error; use the reproduction in the issue to verify the behavior.

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

Mô tả

latent bug

153 calls of pytest.importorskip('petab') (or a petab. submodule) in 20 test files skip their tests when petab cannot be imported for any reason. pytest's importorskip turns a ModuleNotFoundError into a skip, and that includes one raised inside petab for a dependency that petab itself is missing. A petab that is installed but broken therefore does not fail any of these tests. They report as skipped, and some skip reasons name the wrong cause.

Reproduction. Put a stand-in petab on the path whose import fails on a missing dependency:

mkdir -p /tmp/fakepetab/petab
echo "import a_dependency_that_is_missing_xyz" > /tmp/fakepetab/petab/__init__.py
PYTHONPATH=/tmp/fakepetab .venv/bin/python -m pytest -o addopts='' -q -rs tests/test_linear_profiling.py tests/test_expression_objective.py

With the real petab 0.9.0 these two modules run 95 tests, all passing. With the broken one, both modules skip as a whole:

SKIPPED [1] tests/test_linear_profiling.py:39: could not import 'petab': No module named 'a_dependency_that_is_missing_xyz'
SKIPPED [1] tests/test_expression_objective.py:32: objective = expression needs the optional pybnf[petab] extra

The second reason says the extra is not installed. It is installed, and broken.

This matters most where petab breaks in an upgrade. petab has no pin beyond >=0.9,<1, and every CI leg except the dependency-floors one installs it, so a petab release that fails to import in PyBNF's environment would turn these suites into skips on every leg, with CI green.

#1028 added a petab marker that tests/conftest.py skips only when petab is absent (importlib.util.find_spec('petab') is None), and module-level skips in seven tutorial test modules that follow the same rule. A petab that is present but broken fails those tests. Converting the remaining importorskip('petab') calls to the marker, or to the same find_spec check, would give every petab test that behaviour.

Ngôn ngữ chính
Python
Star
25
Fork
25
Merge trung bình
4 giờ 5 phút
Pull request đã merge (30 ngày)
10

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 lanl/PyBNF

Tất cả issue của lanl/PyBNF

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.