diff --git a/lintunes/__init__.py b/lintunes/__init__.py index 514f7ff..1a7372d 100644 --- a/lintunes/__init__.py +++ b/lintunes/__init__.py @@ -1,3 +1,3 @@ """LinTunes — iTunes-style music library manager and player for Linux.""" -__version__ = "0.102.0" +__version__ = "0.102.1" diff --git a/tests/test_round134.py b/tests/test_round134.py index fdc20fb..b9b9aa1 100644 --- a/tests/test_round134.py +++ b/tests/test_round134.py @@ -16,6 +16,22 @@ from lintunes.mumble.sink import ( FRAME_MS, MumbleSink, SAMPLES, apply_gain, bitrate_for) +@pytest.fixture(autouse=True) +def _app(qapp): + """Every test here holds the QApplication. Mixing tests that make Qt + objects with ones that don't freed its wrapper mid-file now and then + (sip's release_QApplication, a segfault in a later test).""" + return qapp + + +def _delete(obj): + """Deleted now, not left for the end of the session: a Qt object still + alive when pytest drops the QApplication segfaulted in sip.""" + from PyQt6.QtCore import QCoreApplication, QEvent + obj.deleteLater() + QCoreApplication.sendPostedEvents(None, QEvent.Type.DeferredDelete.value) + + @pytest.fixture def xdg(tmp_path, monkeypatch): monkeypatch.setenv("XDG_CONFIG_HOME", str(tmp_path / "config")) @@ -357,6 +373,7 @@ def test_sink_generations_and_failure(qapp): assert gone == ["gone"] and not sink.is_playing() assert not sink.can_play(_track("/x.m4p", "Protected AAC audio file")) assert sink.bitrate() == 96000 + _delete(sink) def test_heard_position_trails_what_was_sent(qapp): @@ -366,6 +383,7 @@ def test_heard_position_trails_what_was_sent(qapp): assert sink._heard(stream) == 1000 stream.frames_sent = 50 assert sink._heard(stream) == 1000 + 50 * FRAME_MS - 200 + _delete(sink) # ---- settings ---- @@ -388,6 +406,7 @@ def test_dialog_takes_a_typed_address(qapp): dialog._address.setText("other.example") dialog._accept() assert dialog.selected_server.host == "other.example" + _delete(dialog) # ---- the window ---- @@ -403,6 +422,9 @@ def window(qapp, tmp_path): qapp.processEvents() yield win win.close() + # Deleted now, not left for the end of the session: a window still + # alive when pytest drops the QApplication segfaulted in sip. + _delete(win) def test_menu_has_mumble_and_joins_the_current_server(window, monkeypatch):