summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-06-20 19:39:10 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-06-21 13:14:19 +0200
commit3012cd385be9a4f8a61182ffe0e8257f9b4d09cb (patch)
treec86e2104da92aa81c29ad7a5b0672fa60473111c
parent737b1725ce2fe91aed822c021a5bdb01ee39d65c (diff)
downloadqutebrowser-3012cd385be9a4f8a61182ffe0e8257f9b4d09cb.tar.gz
qutebrowser-3012cd385be9a4f8a61182ffe0e8257f9b4d09cb.zip
notification: Add PID to DBus test notification service
Fixes #7160 (cherry picked from commit 124fc717d17d6ec5d073e68a5ae1a8d0dfa1587b)
-rw-r--r--qutebrowser/browser/webengine/notification.py2
-rw-r--r--tests/end2end/fixtures/notificationserver.py6
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"