fix: Enhancements for the BaseCommands class

This commit is contained in:
Gavin D'souza 2020-09-25 14:35:55 +05:30
parent 6ea47833ec
commit 60e76e0606

View file

@ -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)