From 60e76e0606edc6c0bce37a343606b5f139bfd477 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Fri, 25 Sep 2020 14:35:55 +0530 Subject: [PATCH] fix: Enhancements for the BaseCommands class --- frappe/tests/test_commands.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frappe/tests/test_commands.py b/frappe/tests/test_commands.py index fdab89e4d4..1db25069ad 100644 --- a/frappe/tests/test_commands.py +++ b/frappe/tests/test_commands.py @@ -17,9 +17,14 @@ def clean(value): return value -class BaseTestCommands: - def execute(self, command): - command = command.format(**{"site": frappe.local.site}) +class BaseTestCommands(unittest.TestCase): + def execute(self, command, kwargs): + site = {"site": frappe.local.site} + if kwargs: + kwargs.update(site) + else: + kwargs = site + command = command.replace("\n", " ").format(**kwargs) command = shlex.split(command) self._proc = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.stdout = clean(self._proc.stdout)