Skip to content

pytest 9.0 errors instead of skipping when unittest.SkipTest is raised #13895

@progval

Description

@progval

This code:

import unittest

def test_skiptest():
    raise unittest.SkipTest()

had this behavior on pytest <9.0:

$ rm venv -r
$ python3 -m venv ./venv
$ ./venv/bin/pip install "pytest<9"
[...]
Successfully installed iniconfig-2.3.0 packaging-25.0 pluggy-1.6.0 pygments-2.19.2 pytest-8.4.2
$ ./venv/bin/pytest test.py
=== test session starts ===
platform linux -- Python 3.13.5, pytest-8.4.2, pluggy-1.6.0
rootdir: /home/dev-irc
collected 1 item
test.py s        [100%]

=== 1 skipped in 0.03s ===

and this on pytest 9.0.0:

$ rm venv -r
$ python3 -m venv ./venv
$ ./venv/bin/pip install "pytest==9.0.0"
[...]
Successfully installed iniconfig-2.3.0 packaging-25.0 pluggy-1.6.0 pygments-2.19.2 pytest-9.0.0
$ ./venv/bin/pytest test.py
=== test session starts ===
platform linux -- Python 3.13.5, pytest-9.0.0, pluggy-1.6.0
rootdir: /home/dev-irc
collected 1 item
test.py F       [100%]

==== FAILURES ===
____ test_skiptest ____

    def test_skiptest():
>       raise unittest.SkipTest()
E       unittest.case.SkipTest

test.py:3: SkipTest
=== short test summary info ===
FAILED test.py::test_skiptest - unittest.case.SkipTest
=== 1 failed in 0.06s ===

Python version: 3.13.5

Metadata

Metadata

Assignees

Labels

plugin: unittestrelated to the unittest integration builtin plugintype: regressionindicates a problem that was introduced in a release which was working previously

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions