2022-04-12 14:21:55 +03:00
|
|
|
#!/usr/bin/env python3
|
2017-12-04 22:52:07 +03:00
|
|
|
|
2018-03-12 03:33:06 +03:00
|
|
|
import os
|
2018-09-16 20:24:07 +03:00
|
|
|
import subprocess
|
2018-03-12 03:33:06 +03:00
|
|
|
import sys
|
|
|
|
|
2018-09-16 20:24:07 +03:00
|
|
|
from dbusmock import DBusTestCase
|
|
|
|
|
|
|
|
from lib.config import is_verbose_mode
|
2017-12-04 22:52:07 +03:00
|
|
|
|
2018-07-31 22:20:53 +03:00
|
|
|
def stop():
|
2017-12-04 22:52:07 +03:00
|
|
|
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
|
2018-03-12 03:33:06 +03:00
|
|
|
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
|
2017-12-04 22:52:07 +03:00
|
|
|
|
2018-07-31 22:20:53 +03:00
|
|
|
def start():
|
2024-03-21 16:48:23 +03: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 22:52:07 +03:00
|
|
|
|
2024-03-21 16:48:23 +03:00
|
|
|
DBusTestCase.start_session_bus()
|
|
|
|
DBusTestCase.spawn_server_template('notification_daemon', None, log)
|
2018-03-12 03:33:06 +03:00
|
|
|
|
2018-07-31 22:20:53 +03:00
|
|
|
if __name__ == '__main__':
|
|
|
|
start()
|
|
|
|
try:
|
|
|
|
subprocess.check_call(sys.argv[1:])
|
|
|
|
finally:
|
|
|
|
stop()
|