Skip to contentSkip to conversation

test-runner: use **kwargs for start_process

PATCH Applied James Prestwood 2 participants 2 messages Sep 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-runner: use **kwargs for start_process

This is just a more concise/pythonic way of doing function arguments. Since Process/start_process have basically the same argument names we can simplify and use **kwargs which will pass the named arguments directly to Process(). This also allows us to add arguments to Process without touching start_process if we need.

---
 tools/test-runner | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/test-runner +3 -3
index a71b9ef6..d1e1d42c 100755
@@ -465,10 +465,10 @@ class TestContext:
 		self.results = {}
 		self.mainloop = GLib.MainLoop()
 
-	def start_process(self, args, wait=False, multi_test=False, env=None, check=False):
-		p = Process(args, wait, multi_test, env, ctx=self, check=check)
+	def start_process(self, args, **kwargs):
+		p = Process(args, ctx=self, **kwargs)
 
-		if not wait:
+		if not kwargs.get('wait', False):
 			self.processes.append(p)
 
 		return p
Signature · 1 line
2.26.2
#1 lore raw

Hi James,

Quoted 9 lines · James Prestwood

This is just a more concise/pythonic way of doing function arguments. Since Process/start_process have basically the same argument names we can simplify and use **kwargs which will pass the named arguments directly to Process(). This also allows us to add arguments to Process without touching start_process if we need.

---
  tools/test-runner | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Regards,
-Denis