@@ -33,6 +33,10 @@ class CannotAccessUnity(Exception):
3333def unlock_unity(unity_proxy_obj=None):
3434 """Helper function that attempts to unlock the unity greeter.
3535
36+ If unity_proxy_object is None create a proxy object by querying for the
37+ running unity process.
38+ Otherwise re-use the passed proxy object.
39+
3640 :raises RuntimeError: if the greeter attempts and fails to be unlocked.
3741
3842 :raises RuntimeWarning: when the greeter cannot be found because it is
@@ -65,12 +69,15 @@ def unlock_unity(unity_proxy_obj=None):
6569 greeter.swipe()
6670
6771
68−def restart_unity_with_testability(args=None):
72+def restart_unity_with_testability(*args):
73+ """Restarts (or starts) unity with testability enabled.
74+
75+ Passes *args arguments to the launched process.
76+
77+ """
6978 print("Retarting unity with testability.")
70− if args is None:
71− args = []
72− args.append("QT_LOAD_TESTABILITY=1")
73− return restart_unity(args)
79+ args += ("QT_LOAD_TESTABILITY=1",)
80+ return restart_unity(*args)
7481
7582
7683def restart_unity_normally():
@@ -78,8 +85,10 @@ def restart_unity_normally():
7885 restart_unity()
7986
8087
81−def restart_unity(args=None):
82− """Restarts (or just starts) unity8 with the testability driver loaded
88+def restart_unity(*args):
89+ """Restarts (or starts) unity8 with the testability driver loaded.
90+
91+ Passes *args arguments to the launched process.
8392
8493 :raises subprocess.CalledProcessError: if unable to stop or start the
8594 unity8 upstart job.
@@ -95,12 +104,10 @@ def restart_unity(args=None):
95104 raise
96105
97106 try:
98− if args is None:
99− args = []
100− command = ['initctl', 'start', 'unity8'] + args
107+ command = ['initctl', 'start', 'unity8'] + list(args)
101108 subprocess.check_call(
102109 command,
103− stderr=subprocess.STDOUT
110+ stderr=subprocess.STDOUT,
104111 )
105112
106113 pid = _get_unity_pid()