2022-04-12 11:21:55 +00:00
|
|
|
#!/usr/bin/env python3
|
2017-12-04 19:52:07 +00:00
|
|
|
|
2018-03-12 00:33:06 +00:00
|
|
|
import os
|
2018-09-16 17:24:07 +00:00
|
|
|
import subprocess
|
2018-03-12 00:33:06 +00:00
|
|
|
import sys
|
|
|
|
|
2018-09-16 17:24:07 +00:00
|
|
|
from dbusmock import DBusTestCase
|
|
|
|
|
|
|
|
from lib.config import is_verbose_mode
|
2017-12-04 19:52:07 +00:00
|
|
|
|
2018-07-31 19:20:53 +00:00
|
|
|
def stop():
|
2017-12-04 19:52:07 +00:00
|
|
|
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
|
2018-03-12 00:33:06 +00:00
|
|
|
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
|
2017-12-04 19:52:07 +00:00
|
|
|
|
2018-07-31 19:20:53 +00:00
|
|
|
def start():
|
2024-03-21 13:48:23 +00:00
|
|
|
with sys.stdout if is_verbose_mode() \
|
|
|
|
else open(os.devnull, 'w', encoding='utf-8') as log:
|
|
|
|
DBusTestCase.start_system_bus()
|
|
|
|
DBusTestCase.spawn_server_template('logind', None, log)
|
2017-12-04 19:52:07 +00:00
|
|
|
|
2024-03-21 13:48:23 +00:00
|
|
|
DBusTestCase.start_session_bus()
|
|
|
|
DBusTestCase.spawn_server_template('notification_daemon', None, log)
|
2018-03-12 00:33:06 +00:00
|
|
|
|
2018-07-31 19:20:53 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
start()
|
|
|
|
try:
|
|
|
|
subprocess.check_call(sys.argv[1:])
|
|
|
|
finally:
|
|
|
|
stop()
|