Skip to content

call_on_fail() no longer registers globally since 2.9.1 #203

Description

@Bastian-Krause

Since ba3fdc9 ("corner case fix") introduced in 2.9.1, call_on_fail() no longer registers session global, but tied to the test phase. This breaks the example in https://github.com/okken/pytest-check#logging-to-a-file as well as examples/logging_to_a_file/.

On 2.8.0:

$ pytest -q examples/logging_to_a_file/ > /dev/null
$ cat session.log
--- 2026-08-13 11:58:03.366 ---
---------
Starting test run
---------
--- 2026-08-13 11:58:03.373 ---
FAILURE: check 1 == 2
examples/logging_to_a_file/test_file_logging.py:4 in test_one() -> check.equal(1, 2)

--- 2026-08-13 11:58:03.375 ---
FAILURE: check 5 == 6
examples/logging_to_a_file/test_file_logging.py:7 in test_two() -> check.equal(5, 6)

On 2.9.1:

$ pytest -q examples/logging_to_a_file/ > /dev/null
$ cat session.log
--- 2026-08-13 11:58:25.393 ---
---------
Starting test run
---------

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions