Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_exceptions_dont_leak fails with Python 3.12 #532

Closed
juliangilbey opened this issue Dec 20, 2023 · 7 comments · Fixed by #535
Closed

test_exceptions_dont_leak fails with Python 3.12 #532

juliangilbey opened this issue Dec 20, 2023 · 7 comments · Fixed by #535

Comments

@juliangilbey
Copy link

Hi! Debian is in the process of migrating to Python 3.12, and we have discovered that one of the tests in pytest-qt fails with Python 3.12. Here is the output of running pytest using Python 3.12 and then Python 3.11. There are lots of warnings, but one failure in the 3.12 tests which passes in the 3.11 tests. These tests are being run in a clean chroot, and the version qt-4.2.0+repack is just renamed from the original qt-4.2.0 (the contents are identical).

I: pybuild base:310: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pytestqt/build; python3.12 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0
PyQt5 5.15.10 -- Qt runtime 5.15.10 -- Qt compiled 5.15.10
rootdir: /<<PKGBUILDDIR>>
configfile: setup.cfg
plugins: qt-4.2.0+repack, xvfb-3.0.0
collected 378 items

tests/test_basics.py .............................................       [ 11%]
tests/test_exceptions.py ..............F                                 [ 15%]
tests/test_logging.py ................................                   [ 24%]
tests/test_modeltest.py ................................                 [ 32%]
tests/test_qtbot_pep8_aliases.py ...........                             [ 35%]
tests/test_qtest_proxies.py ..............                               [ 39%]
tests/test_screenshot.py .............                                   [ 42%]
tests/test_wait_signal.py .............................................. [ 55%]
........................................................................ [ 74%]
...........................................................s............ [ 93%]
...s................                                                     [ 98%]
tests/test_wait_until.py ......                                          [100%]

=================================== FAILURES ===================================
__________________________ test_exceptions_dont_leak ___________________________

testdir = <Testdir local('/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0')>

    @pytest.mark.xfail(
        condition=sys.version_info[:2] == (3, 4),
        reason="failing in Python 3.4, which is about to be dropped soon anyway",
    )
    def test_exceptions_dont_leak(testdir):
        """
        Ensure exceptions are cleared when an exception occurs and don't leak (#187).
        """
        testdir.makepyfile(
            """
            from pytestqt.qt_compat import qt_api
            import gc
            import weakref
    
            class MyWidget(qt_api.QtWidgets.QWidget):
    
                def event(self, ev):
                    called.append(1)
                    raise RuntimeError('event processed')
    
            weak_ref = None
            called = []
    
            def test_1(qapp):
                global weak_ref
                w = MyWidget()
                weak_ref = weakref.ref(w)
                qapp.postEvent(w, qt_api.QtCore.QEvent(qt_api.QtCore.QEvent.Type.User))
                qapp.processEvents()
    
            def test_2(qapp):
                assert called
                gc.collect()
                assert weak_ref() is None
        """
        )
        result = testdir.runpytest()
>       result.stdout.fnmatch_lines(["*1 failed, 1 passed*"])
E       Failed: nomatch: '*1 failed, 1 passed*'
E           and: '============================= test session starts =============================='
E           and: 'platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0'
E           and: 'PyQtAPI 1.0 -- Qt runtime 2.5 -- Qt compiled 3.5'
E           and: 'rootdir: /tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0'
E           and: 'plugins: qt-4.2.0+repack, xvfb-3.0.0'
E           and: 'collected 2 items'
E           and: ''
E           and: 'test_exceptions_dont_leak.py FF                                          [100%]'
E           and: ''
E           and: '=================================== FAILURES ==================================='
E           and: '____________________________________ test_1 ____________________________________'
E           and: 'CALL ERROR: Exceptions caught in Qt event loop:'
E           and: '________________________________________________________________________________'
E           and: 'Traceback (most recent call last):'
E           and: '  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event'
E           and: "    raise RuntimeError('event processed')"
E           and: 'RuntimeError: event processed'
E           and: '________________________________________________________________________________'
E           and: 'Traceback (most recent call last):'
E           and: '  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event'
E           and: "    raise RuntimeError('event processed')"
E           and: 'RuntimeError: event processed'
E           and: '________________________________________________________________________________'
E           and: '----------------------------- Captured stderr call -----------------------------'
E           and: 'Exceptions caught in Qt event loop:'
E           and: '________________________________________________________________________________'
E           and: 'Traceback (most recent call last):'
E           and: '  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event'
E           and: "    raise RuntimeError('event processed')"
E           and: 'RuntimeError: event processed'
E           and: '________________________________________________________________________________'
E           and: 'Exceptions caught in Qt event loop:'
E           and: '________________________________________________________________________________'
E           and: 'Traceback (most recent call last):'
E           and: '  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event'
E           and: "    raise RuntimeError('event processed')"
E           and: 'RuntimeError: event processed'
E           and: '________________________________________________________________________________'
E           and: '____________________________________ test_2 ____________________________________'
E           and: ''
E           and: 'qapp = <PyQt5.QtWidgets.QApplication object at 0x7fc6ed0bb6e0>'
E           and: ''
E           and: '    def test_2(qapp):'
E           and: '        assert called'
E           and: '        gc.collect()'
E           and: '>       assert weak_ref() is None'
E           and: 'E       assert <test_exceptions_dont_leak.MyWidget object at 0x7fc6eccdfc80> is None'
E           and: 'E        +  where <test_exceptions_dont_leak.MyWidget object at 0x7fc6eccdfc80> = weak_ref()'
E           and: ''
E           and: 'test_exceptions_dont_leak.py:24: AssertionError'
E           and: '=========================== short test summary info ============================'
E           and: 'FAILED test_exceptions_dont_leak.py::test_1 - Failed: CALL ERROR: Exceptions ...'
E           and: 'FAILED test_exceptions_dont_leak.py::test_2 - assert <test_exceptions_dont_le...'
E           and: '============================== 2 failed in 0.05s ==============================='
E       remains unmatched: '*1 failed, 1 passed*'

/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py:381: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.3, pluggy-1.3.0
PyQtAPI 1.0 -- Qt runtime 2.5 -- Qt compiled 3.5
rootdir: /tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0
plugins: qt-4.2.0+repack, xvfb-3.0.0
collected 2 items

test_exceptions_dont_leak.py FF                                          [100%]

=================================== FAILURES ===================================
____________________________________ test_1 ____________________________________
CALL ERROR: Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event
    raise RuntimeError('event processed')
RuntimeError: event processed
________________________________________________________________________________
Traceback (most recent call last):
  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event
    raise RuntimeError('event processed')
RuntimeError: event processed
________________________________________________________________________________
----------------------------- Captured stderr call -----------------------------
Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event
    raise RuntimeError('event processed')
RuntimeError: event processed
________________________________________________________________________________
Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/tmp/pytest-of-jdg/pytest-0/test_exceptions_dont_leak0/test_exceptions_dont_leak.py", line 9, in event
    raise RuntimeError('event processed')
RuntimeError: event processed
________________________________________________________________________________
____________________________________ test_2 ____________________________________

qapp = <PyQt5.QtWidgets.QApplication object at 0x7fc6ed0bb6e0>

    def test_2(qapp):
        assert called
        gc.collect()
>       assert weak_ref() is None
E       assert <test_exceptions_dont_leak.MyWidget object at 0x7fc6eccdfc80> is None
E        +  where <test_exceptions_dont_leak.MyWidget object at 0x7fc6eccdfc80> = weak_ref()

test_exceptions_dont_leak.py:24: AssertionError
=========================== short test summary info ============================
FAILED test_exceptions_dont_leak.py::test_1 - Failed: CALL ERROR: Exceptions ...
FAILED test_exceptions_dont_leak.py::test_2 - assert <test_exceptions_dont_le...
============================== 2 failed in 0.05s ===============================
=============================== warnings summary ===============================
.pybuild/cpython3_3.12_pytestqt/build/tests/test_basics.py::test_event_processing_before_and_after_teardown
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805471 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_basics.py::test_header
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805496 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_basics.py::test_widgets_closed_before_fixtures
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805500 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_basics.py::test_before_close_func
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805504 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_catch_exceptions_in_virtual_methods[False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805560 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_catch_exceptions_in_virtual_methods[True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805565 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_no_capture[True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805569 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_no_capture[False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805573 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_no_capture_preserves_custom_excepthook
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805577 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_call
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805581 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_widget_close
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805585 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_fixture_setup_and_teardown[setup]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805589 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_fixture_setup_and_teardown[teardown]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805593 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_capture_exceptions_qtbot_context_manager
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805597 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_exceptions.py::test_exceptions_dont_leak
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805601 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_basic_logging[True-True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805606 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_basic_logging[True-False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805610 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_basic_logging[False-True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805614 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_basic_logging[False-False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805618 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_fixture_with_logging_disabled[--no-qt-log]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805622 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_fixture_with_logging_disabled[--capture=no]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805626 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_fixture_with_logging_disabled[-s]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805630 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_disable_qtlog_context_manager[True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805634 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_disable_qtlog_context_manager[False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805639 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_disable_qtlog_mark[True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805643 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_disable_qtlog_mark[False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805647 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_formatting
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805651 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[DEBUG-1]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805655 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[WARNING-2]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805659 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[CRITICAL-3]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805663 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[NO-4]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805667 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_tests_mark
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805671 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_ignore
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805675 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark', extend=True-match-global]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805679 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark', extend=True-match-mark]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805683 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark'-match-global]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805687 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark'-match-mark]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805691 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_without_extend[match-global-True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805695 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_without_extend[match-mark-False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805699 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_mark_with_invalid_argument
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805703 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_ignore_mark_multiple[True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805708 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_logging_fails_ignore_mark_multiple[False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805712 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_lineno_failure
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805716 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_logging.py::test_context_none
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805720 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_modeltest.py::test_qt_tester_valid
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805724 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_modeltest.py::test_qt_tester_invalid
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805733 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_qtest_proxies.py::test_keyToAscii_not_available_on_pyqt
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805737 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_wait_signal.py::test_raising[false-False]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805741 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_wait_signal.py::test_raising[true-True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805747 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_wait_signal.py::test_raising[None-True]
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805752 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.12_pytestqt/build/tests/test_wait_signal.py::test_raising_by_default_overridden
  /usr/lib/python3.12/subprocess.py:1127: ResourceWarning: subprocess 805756 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_exceptions.py::test_exceptions_dont_leak - Failed: nomatch:...
============ 1 failed, 375 passed, 2 skipped, 51 warnings in 34.51s ============
E: pybuild pybuild:395: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_pytestqt/build; python3.12 -m pytest tests
I: pybuild pybuild:314: python3.11 setup.py egg_info -e /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build
/usr/lib/python3/dist-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
WARNING: The wheel package is not available.
WARNING setuptools_scm.pyproject_reading toml section missing 'pyproject.toml does not contain a tool.setuptools_scm section'
running egg_info
creating /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info
writing /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/PKG-INFO
writing dependency_links to /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/dependency_links.txt
writing entry points to /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/entry_points.txt
writing requirements to /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/requires.txt
writing top-level names to /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/top_level.txt
writing manifest file '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/SOURCES.txt'
reading manifest file '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build/pytest_qt.egg-info/SOURCES.txt'
I: pybuild base:310: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pytestqt/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-7.4.3, pluggy-1.3.0
PyQt5 5.15.10 -- Qt runtime 5.15.10 -- Qt compiled 5.15.10
rootdir: /<<PKGBUILDDIR>>
configfile: setup.cfg
plugins: qt-4.2.0+repack, xvfb-3.0.0
collected 378 items

tests/test_basics.py .............................................       [ 11%]
tests/test_exceptions.py ...............                                 [ 15%]
tests/test_logging.py ................................                   [ 24%]
tests/test_modeltest.py ................................                 [ 32%]
tests/test_qtbot_pep8_aliases.py ...........                             [ 35%]
tests/test_qtest_proxies.py ..............                               [ 39%]
tests/test_screenshot.py .............                                   [ 42%]
tests/test_wait_signal.py .............................................. [ 55%]
........................................................................ [ 74%]
...........................................................s............ [ 93%]
...s................                                                     [ 98%]
tests/test_wait_until.py ......                                          [100%]

=============================== warnings summary ===============================
.pybuild/cpython3_3.11_pytestqt/build/tests/test_basics.py::test_event_processing_before_and_after_teardown
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805784 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_basics.py::test_header
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805810 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_basics.py::test_widgets_closed_before_fixtures
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805814 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_basics.py::test_before_close_func
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805818 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_catch_exceptions_in_virtual_methods[False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805874 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_catch_exceptions_in_virtual_methods[True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805878 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_no_capture[True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805882 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_no_capture[False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805886 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_no_capture_preserves_custom_excepthook
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805890 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_call
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805894 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_widget_close
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805898 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_fixture_setup_and_teardown[setup]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805902 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_exception_capture_on_fixture_setup_and_teardown[teardown]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805906 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_capture_exceptions_qtbot_context_manager
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805910 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_exceptions.py::test_exceptions_dont_leak
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805914 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_basic_logging[True-True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805918 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_basic_logging[True-False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805923 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_basic_logging[False-True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805927 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_basic_logging[False-False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805931 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_fixture_with_logging_disabled[--no-qt-log]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805935 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_fixture_with_logging_disabled[--capture=no]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805939 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_fixture_with_logging_disabled[-s]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805943 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_disable_qtlog_context_manager[True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805947 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_disable_qtlog_context_manager[False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805951 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_disable_qtlog_mark[True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805955 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_disable_qtlog_mark[False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805959 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_formatting
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805963 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[DEBUG-1]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805967 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[WARNING-2]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805971 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[CRITICAL-3]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805975 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_tests[NO-4]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805979 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_tests_mark
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805983 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_ignore
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805987 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark', extend=True-match-global]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805992 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark', extend=True-match-mark]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 805996 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark'-match-global]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806000 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_with_extend['match-mark'-match-mark]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806004 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_without_extend[match-global-True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806008 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_without_extend[match-mark-False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806012 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_mark_with_invalid_argument
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806016 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_ignore_mark_multiple[True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806020 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_logging_fails_ignore_mark_multiple[False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806024 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_lineno_failure
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806028 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_logging.py::test_context_none
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806032 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_modeltest.py::test_qt_tester_valid
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806036 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_modeltest.py::test_qt_tester_invalid
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806045 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_qtest_proxies.py::test_keyToAscii_not_available_on_pyqt
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806049 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_wait_signal.py::test_raising[false-False]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806054 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_wait_signal.py::test_raising[true-True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806060 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_wait_signal.py::test_raising[None-True]
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806064 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

.pybuild/cpython3_3.11_pytestqt/build/tests/test_wait_signal.py::test_raising_by_default_overridden
  /usr/lib/python3.11/subprocess.py:1127: ResourceWarning: subprocess 806068 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================= 376 passed, 2 skipped, 51 warnings in 34.24s =================
@nicoddemus
Copy link
Member

Hi,

What is happening is that the w = MyWidget() instance is leaking to test_2-- this used to happen because we would keep a reference to the error traceback, which would contain the locals of test_1, but that really should not be the case because we clear the exceptions between tests now:

def fail_if_exceptions_occurred(self, when):
"""calls pytest.fail() with an informative message if exceptions
have been captured so far. Before pytest.fail() is called, also
finish capturing.
"""
if self.exceptions:
self.finish()
exceptions = self.exceptions
self.exceptions = []
prefix = "%s ERROR: " % when
msg = prefix + format_captured_exceptions(exceptions)
del exceptions[:] # Don't keep exceptions alive longer.
pytest.fail(msg, pytrace=False)

Not sure what else could be causing this in your system, I'm afraid.

@juliangilbey
Copy link
Author

Thanks @nicoddemus! I couild try tracing that function perhaps? It's clearly some difference in behaviour between Python 3.11 and Python 3.12, at least on my chroot. Would you be able to add Python 3.12 to the list of Python versions tested in .github/workflows/main.yml (and perhaps tox.ini too, which doesn't yet include 3.11, BTW)? That way, we would be able to see if it's my system or whether it's a more consistent problem.

@juliangilbey
Copy link
Author

It seems like the Python 3.12 behaviour is quite different from the Python 3.11 behaviour. I don't understand enough about PyQt5 and Python 3.12 vs Python 3.11 to know what has caused this. Here's what I tried. I modified the test to read:

        def test_1(qapp):                                                       
            global weak_ref                                                     
            w = MyWidget()                                                      
            weak_ref = weakref.ref(w)                                           
            print("weak_ref in test_1 =", weak_ref())                           
            qapp.postEvent(w, qt_api.QtCore.QEvent(qt_api.QtCore.QEvent.Type.User))                                                                            
            qapp.processEvents()                                                
                                                                                
        def test_2(qapp):                                                       
            assert called                                                       
            print("weak_ref in test_2 pre-collect =", weak_ref())               
            gc.collect()                                                        
            print("weak_ref in test_2 post-collect =", weak_ref())              
            assert weak_ref() is None                                           
            print("weak_ref in test_2 post-assert =", weak_ref())               
    """
    )
    result = testdir.runpytest("--capture=tee-sys")
    result.stdout.fnmatch_lines(["*1 failed, 1 passed*"])

This allows me to see how the weak_ref object changes over time. With Python 3.11, I get the following (dropping everything other than the print statement outputs):

weak_ref in test_1 = <test_exceptions_dont_leak.MyWidget object at 0x7f160cec6950>
weak_ref in test_2 pre-collect = None
weak_ref in test_2 post-collect = None
weak_ref in test_2 post-assert = None

But with Python 3.12, I get:

weak_ref in test_1 = <test_exceptions_dont_leak.MyWidget object at 0x7f2e7d06f380>
weak_ref in test_2 pre-collect = <test_exceptions_dont_leak.MyWidget object at 0x7f2e7d06f380>
weak_ref in test_2 post-collect = <test_exceptions_dont_leak.MyWidget object at 0x7f2e7d06f380>

So it seems that the object is not garbage-collected at all. This may be a result of the modified garbage collection behaviour in Python 3.12, but it seems a little bizarre for this to be the case. Perhaps something else is going on?

I then tried mimicking the pytest-qt script, but without any calls to qapp or pytest:

import gc
import weakref

class MyClass:
    def __init__(self):
        self.var = 1

weak_ref = None


def func1():
    global weak_ref

    c = MyClass()
    weak_ref = weakref.ref(c)
    print("weak_ref in func1 =", weak_ref())


def func2():
    print("weak_ref in func2 pre-collect =", weak_ref())
    gc.collect()
    print("weak_ref in func2 post-collect =", weak_ref())


func1()
func2()

and the results are as expected:

weak_ref in func1 = <__main__.MyClass object at 0x7fb5b4101990>
weak_ref in func2 pre-collect = None
weak_ref in func2 post-collect = None

with both Python 3.11 and Python 3.12.

I then modified it to use pytest:

def test_func1():
    global weak_ref

    c = MyClass()
    weak_ref = weakref.ref(c)
    assert weak_ref() is not None


def test_func2():
    gc.collect()
    assert weak_ref() is None

and pytest succeeds with both Python 3.11 and Python 3.12.

I'm not sure what to suggest from here :(

nicoddemus added a commit to nicoddemus/pytest-qt that referenced this issue Dec 22, 2023
@nicoddemus
Copy link
Member

Thanks @juliangilbey for the detailed post.

I did not realize that we were not testing with Python 3.12 yet.

I added testing for CI in 3.12 and the problem exists in all platforms, which will help debug this greatly.

Regardless, I just released 4.3.1 which skips this test on Python 3.12, which should at least alleviate your immediate problem.

I plan to investigate this in more detail when I have some time.

Thanks again.

@graingert
Copy link
Member

graingert commented Dec 22, 2023

I ran this test and inspected the live object with objgraph:
objgraph-n3eoc_9o

https://docs.python.org/3/library/sys.html#sys.last_exc is new in 3.12

@nicoddemus
Copy link
Member

Awesome @graingert, nailed that right on the head. 😁

#535

@juliangilbey
Copy link
Author

Oh wow, thanks @graingert; what great detective work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants