Improved unittest for cpl new

This commit is contained in:
2022-05-27 18:07:12 +02:00
parent 162f06001a
commit ff5f9b833d
2 changed files with 38 additions and 6 deletions

View File

@@ -7,9 +7,10 @@ from unittests_cli.constants import CLI_PATH
class CLICommands:
@staticmethod
def _run(cmd: str, *args):
def _run(cmd: str, *args, output=False):
env_vars = os.environ
env_vars['CPL_IS_UNITTEST'] = 'YES'
env_vars['CPL_IS_UNITTEST'] = 'NO' if output else 'YES'
command = ['python', CLI_PATH, cmd]
for arg in args:
command.append(arg)
@@ -17,9 +18,9 @@ class CLICommands:
subprocess.run(command, env=env_vars)
@classmethod
def generate(cls, schematic: str, name: str):
cls._run('generate', schematic, name)
def generate(cls, schematic: str, name: str, output=False):
cls._run('generate', schematic, name, output=output)
@classmethod
def new(cls, project_type: str, name: str, *args):
cls._run('new', project_type, name, *args)
def new(cls, project_type: str, name: str, *args, output=False):
cls._run('new', project_type, name, *args, output=output)