diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-06-20 19:39:10 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-06-21 12:26:40 +0200 |
commit | e30258bc75feb8b6ddee9860e1335c3dc32c2ff0 (patch) | |
tree | 81a45ec15bf3049fe4d7e1e5bca1e61be6779851 | |
parent | c457183d042a1e66d8f483a22c2c349c379b8f55 (diff) | |
download | qutebrowser-e30258bc75feb8b6ddee9860e1335c3dc32c2ff0.tar.gz qutebrowser-e30258bc75feb8b6ddee9860e1335c3dc32c2ff0.zip |
notifications: Add PID to DBus test notification service
Fixes #7160
-rw-r--r-- | qutebrowser/browser/webengine/notification.py | 2 | ||||
-rw-r--r-- | 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 498cb39fb..b08b5b59b 100644 --- a/qutebrowser/browser/webengine/notification.py +++ b/qutebrowser/browser/webengine/notification.py @@ -769,7 +769,7 @@ class DBusNotificationAdapter(AbstractNotificationAdapter): self._watcher.serviceUnregistered.connect(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" |