pytest-dev / pytest-dev/pytest

warn when the cmdline_main hook raises systemexit

Open
#8,986 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

While packaging scipy on PPC for conda-forge, I got caught out by the test suite failing at correction time, but erroneously reporting exit 0: https://github.com/conda-forge/scipy-feedstock/issues/186

+ python -c 'import scipy; scipy.test(verbose=2, label='\''full'\'', extra_argv=['\''--durations=50'\''])'
============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- $PREFIX/bin/python
cachedir: .pytest_cache
rootdir: $SRC_DIR
plugins: xdist-2.3.0, forked-1.3.0
collecting ... collected 46106 items / 1 error / 46105 selected

==================================== ERRORS ====================================
[snip]
=========================== short test summary info ============================
ERROR linalg/tests/test_sketches.py - ValueError: row index exceeds matrix di...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 error in 713.78s (0:11:53) =========================
+ exit 0

Here's the signature of scipy.test and how this maps into pytest.main.

This should be reproducible - probably only on PPC? - as follows (since the CI passed, the artefacts got published; not yet sure if we'll recall them):

conda create -n test_env -c conda-forge python scipy
conda activate test_env
python -c "import scipy; scipy.test(verbose=2, label='full', extra_argv=['--durations=50'])"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the scipy/_lib/_testutils.py scipy.test signature linked in the issue and trace how it maps into pytest.main, focusing on the cmdline_main hook and SystemExit handling. Reproduce with the provided conda environment command and verify that a collection failure no longer reports exit 0 and instead emits the intended warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.