electron/script/dbus_mock.py
Charles Kerr 61ddb1aa07
chore: bump pylint to 2.17 (#41576)
* build: bump pylint to 2.17

Xref: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5062345

* fix pylint consider-using-f-string warnings pt 1: use flynt for automated fixes

* fix pylint consider-using-f-string warnings pt 2: manual fixes

* fix pylint consider-using-with warnings

* fix pylint line-too-long warnings

* fix pylint unspecified-encoding warnings

* fix py lint consider-using-generator warning

* fixup! fix pylint unspecified-encoding warnings

* fix pylint line-too-long warnings
2024-03-21 09:48:23 -04:00

29 lines
730 B
Python

#!/usr/bin/env python3
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
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)
DBusTestCase.start_session_bus()
DBusTestCase.spawn_server_template('notification_daemon', None, log)
if __name__ == '__main__':
start()
try:
subprocess.check_call(sys.argv[1:])
finally:
stop()