sh_cpl/unittests/unittests_shared/cli_commands.py

26 lines
525 B
Python
Raw Normal View History

2022-05-26 14:47:36 +02:00
import os
import subprocess
2022-05-26 15:29:49 +02:00
from unittests_cli.constants import CLI_PATH
2022-05-26 14:47:36 +02:00
class CLICommands:
@staticmethod
def _run(cmd: str, *args):
env_vars = os.environ
env_vars['CPL_IS_UNITTEST'] = 'YES'
2022-05-26 15:29:49 +02:00
command = ['python', CLI_PATH, cmd]
2022-05-26 14:47:36 +02:00
for arg in args:
command.append(arg)
subprocess.run(command, env=env_vars)
@classmethod
def generate(cls, *args):
cls._run('generate', *args)
@classmethod
def new(cls, *args):
cls._run('new', *args)