2018-03-12 00:33:06 +00:00
|
|
|
from config import is_verbose_mode
|
2017-12-04 19:52:07 +00:00
|
|
|
from dbusmock import DBusTestCase
|
|
|
|
|
|
|
|
import atexit
|
2018-03-12 00:33:06 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
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():
|
|
|
|
dbusmock_log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')
|
2017-12-04 19:52:07 +00:00
|
|
|
|
2018-07-31 19:20:53 +00:00
|
|
|
DBusTestCase.start_system_bus()
|
|
|
|
DBusTestCase.spawn_server_template('logind', None, dbusmock_log)
|
2018-03-12 00:33:06 +00:00
|
|
|
|
2018-07-31 19:20:53 +00:00
|
|
|
DBusTestCase.start_session_bus()
|
|
|
|
DBusTestCase.spawn_server_template('notification_daemon', None, dbusmock_log)
|
2018-03-12 00:33:06 +00:00
|
|
|
|
2018-07-31 19:20:53 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import subprocess
|
|
|
|
start()
|
|
|
|
try:
|
|
|
|
subprocess.check_call(sys.argv[1:])
|
|
|
|
finally:
|
|
|
|
stop()
|