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
|
|
|
|
|
|
|
def cleanup():
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
atexit.register(cleanup)
|
2018-03-12 00:33:06 +00:00
|
|
|
|
|
|
|
dbusmock_log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')
|
|
|
|
|
2017-12-04 19:52:07 +00:00
|
|
|
DBusTestCase.start_system_bus()
|
2018-03-12 00:33:06 +00:00
|
|
|
DBusTestCase.spawn_server_template('logind', None, dbusmock_log)
|
|
|
|
|
|
|
|
DBusTestCase.start_session_bus()
|
|
|
|
DBusTestCase.spawn_server_template('notification_daemon', None, dbusmock_log)
|