[gnome-control-center/benzea/reenable-tests] tests: Disable all service start dirs
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/benzea/reenable-tests] tests: Disable all service start dirs
- Date: Thu, 20 Jan 2022 14:49:54 +0000 (UTC)
commit 1084bacc6c7cc31cf89e47b020aaccc51cb9cc56
Author: Benjamin Berg <bberg redhat com>
Date: Thu Jan 20 15:49:33 2022 +0100
tests: Disable all service start dirs
tests/shared/x11session.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
---
diff --git a/tests/shared/x11session.py b/tests/shared/x11session.py
index a7cfdf64b..b22a8cc65 100644
--- a/tests/shared/x11session.py
+++ b/tests/shared/x11session.py
@@ -42,6 +42,60 @@ class X11SessionTestCase(DBusTestCase):
klass.start_system_bus()
klass.start_session_bus()
+ @classmethod
+ def start_session_bus(cls) -> None:
+ '''Set up a private local session bus
+
+ This gets stopped automatically in tearDownClass().
+ '''
+ with tempfile.NamedTemporaryFile(prefix='dbusmock_session_cfg') as c:
+ c.write(b'''<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <type>session</type>
+ <keep_umask/>
+ <listen>unix:tmpdir=/tmp</listen>
+ <!-- We do not add standard_system_servicedirs (i.e. we have *no* service directory). -->
+
+ <policy context="default">
+ <allow send_destination="*" eavesdrop="true"/>
+ <allow eavesdrop="true"/>
+ <allow own="*"/>
+ </policy>
+</busconfig>
+''')
+ c.flush()
+ (DBusTestCase.system_bus_pid, addr) = cls.start_dbus(conf=c.name)
+ os.environ['DBUS_SESSION_BUS_ADDRESS'] = addr
+
+ @classmethod
+ def start_system_bus(cls) -> None:
+ '''Set up a private local system bus
+
+ This gets stopped automatically in tearDownClass().
+ '''
+ # create a temporary configuration which makes the fake bus actually
+ # appear a type "system"
+ with tempfile.NamedTemporaryFile(prefix='dbusmock_cfg') as c:
+ c.write(b'''<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <type>system</type>
+ <keep_umask/>
+ <listen>unix:tmpdir=/tmp</listen>
+ <!-- We do not add standard_system_servicedirs (i.e. we have *no* service directory). -->
+
+ <policy context="default">
+ <allow send_destination="*" eavesdrop="true"/>
+ <allow eavesdrop="true"/>
+ <allow own="*"/>
+ </policy>
+</busconfig>
+''')
+ c.flush()
+ (DBusTestCase.system_bus_pid, addr) = cls.start_dbus(conf=c.name)
+ os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = addr
+
@classmethod
def start_xorg(klass):
r, w = os.pipe()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]