From 3012cd385be9a4f8a61182ffe0e8257f9b4d09cb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 20 Jun 2022 19:39:10 +0200 Subject: notification: Add PID to DBus test notification service Fixes #7160 (cherry picked from commit 124fc717d17d6ec5d073e68a5ae1a8d0dfa1587b) --- qutebrowser/browser/webengine/notification.py | 2 +- tests/end2end/fixtures/notificationserver.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/webengine/notification.py b/qutebrowser/browser/webengine/notification.py index 566178052..85e1eb4fa 100644 --- a/qutebrowser/browser/webengine/notification.py +++ b/qutebrowser/browser/webengine/notification.py @@ -767,7 +767,7 @@ class DBusNotificationAdapter(AbstractNotificationAdapter): self._on_service_unregistered) test_service = 'test-notification-service' in objects.debug_flags - service = self.TEST_SERVICE if test_service else self.SERVICE + service = f"{self.TEST_SERVICE}{os.getpid()}" if test_service else self.SERVICE self.interface = QDBusInterface(service, self.PATH, self.INTERFACE, bus) if not self.interface.isValid(): diff --git a/tests/end2end/fixtures/notificationserver.py b/tests/end2end/fixtures/notificationserver.py index b643e848b..3f8cb0b1f 100644 --- a/tests/end2end/fixtures/notificationserver.py +++ b/tests/end2end/fixtures/notificationserver.py @@ -231,14 +231,16 @@ class TestNotificationServer(QObject): @pytest.fixture(scope='module') -def notification_server(qapp): +def notification_server(qapp, quteproc_process): if utils.is_windows: # The QDBusConnection destructor seems to cause error messages (and potentially # segfaults) on Windows, so we bail out early in that case. We still try to get # a connection on macOS, since it's theoretically possible to run DBus there. pytest.skip("Skipping DBus on Windows") - server = TestNotificationServer(notification.DBusNotificationAdapter.TEST_SERVICE) + qb_pid = quteproc_process.proc.pid() + server = TestNotificationServer( + f"{notification.DBusNotificationAdapter.TEST_SERVICE}{qb_pid}") registered = server.register() if not registered: assert not (utils.is_linux and testutils.ON_CI), "Expected DBus on Linux CI" -- cgit v1.2.3-54-g00ecf