sh_cpl/unittests/unittests_cli/new_test_case.py

33 lines
1017 B
Python
Raw Normal View History

2022-05-26 21:42:43 +02:00
import os
import shutil
2022-05-26 13:49:31 +02:00
import unittest
2022-05-26 21:42:43 +02:00
from cpl_core.utils import String
from unittests_cli.constants import PLAYGROUND_PATH
from unittests_shared.cli_commands import CLICommands
2022-05-26 13:49:31 +02:00
class NewTestCase(unittest.TestCase):
def setUp(self):
pass
2022-05-26 21:42:43 +02:00
def _test_project(self, project_type: str, name: str, *args):
CLICommands.new(project_type, name, *args)
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, String.convert_to_snake_case(name)))
self.assertTrue(os.path.exists(project_path))
shutil.rmtree(project_path)
def test_console(self):
print(f'{__name__} new console')
self._test_project('console', 'test-console', '--ab', '--s', '--sp')
def test_library(self):
print(f'{__name__} new library')
self._test_project('library', 'test-library', '--ab', '--s', '--sp')
def test_unittest(self):
print(f'{__name__} new unittests')
self._test_project('unittest', 'test-unittest', '--ab', '--s', '--sp')