Skip to content

Twisted: Incompability with pytest.skip and Twisted 25.5 #13497

Description

@nicoddemus

The recently released twisted 25.5.0 is causing the test test_trial_exceptions_with_skips to fail:

https://github.com/pytest-dev/pytest/actions/runs/15509383216/job/43668300225?pr=13496

Created this MWE:

from __future__ import annotations

from twisted.trial import unittest

import pytest


class TC(unittest.TestCase):
    def test_hello(self):
        pytest.skip("skip_in_method")
λ uvx --with pytest,twisted==24.11 pytest testing\test_trial.py -q
s                                                                                                                                                                                                         [100%]
1 skipped in 0.13s
λ uvx --with pytest,twisted==25.5 pytest testing\test_trial.py -q
F                                                              [100%]
============================= FAILURES ==============================
___________________________ TC.test_hello ___________________________
skip_in_method

During handling of the above exception, another exception occurred:
'NoneType' object is not iterable

During handling of the above exception, another exception occurred:
NOTE: Incompatible Exception Representation, displaying natively:

Skipped: skip_in_method

====================== short test summary info ======================
FAILED testing/test_trial.py::TC::test_hello - Failed: NOTE: Incompatible Exception Representation, displaying n...
1 failed in 0.14s

Activity

  1. p12tic commented on Jun 9, 2025

    @p12tic

    See analysis here twisted/twisted#12467 (comment). pytest patches twisted.python.failure.Failure.__init__ and it breaks in Twisted 25.5 because there's an additional except/raise pair in Twisted test framework code.

  2. nicoddemus commented on Jun 9, 2025

    @nicoddemus
    MemberAuthor

    Thanks @p12tic appreciate the link.

    We are happy to fix pytest, after all we are patching the internals. Do you have any suggestion on how we can fix pytest?

  3. added 15 commits that reference this issue on Jun 9, 2025
    e9523ef
    1ce2bdd
    e30e0a0
    d12b29a
    d0ee227
    36c57ab
    96f0319
    646b58b
    c48c810
    f519098
    503b70f
    f048110
    eecd314
    f12a5bd
    4e533f7
  4. added a commit that references this issue on Jun 17, 2025
    01dce85
  5. added a commit that references this issue on Jun 17, 2025
    44b4dfe
  6. added a commit that references this issue on Jun 17, 2025
    a1b3a78
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions