Compare commits

..

No commits in common. "ba1b5e49ae9407a5a5bb0cc5339fe950e4f363b2" and "4a54bb62de7b5440de600a6a53109f8ab5987df1" have entirely different histories.

3 changed files with 5 additions and 33 deletions

View File

@ -54,7 +54,6 @@ class NewService(CommandABC):
self._use_service_providing: bool = False
self._use_async: bool = False
self._use_venv: bool = False
self._use_base: bool = False
@property
def help_message(self) -> str:
@ -160,8 +159,7 @@ class NewService(CommandABC):
if self._workspace is None:
project_path = os.path.join(self._env.working_directory, self._rel_path, self._project.name)
else:
base = '' if self._use_base else 'src'
project_path = os.path.join(self._env.working_directory, base, self._rel_path, String.convert_to_snake_case(self._project.name))
project_path = os.path.join(self._env.working_directory, 'src', self._rel_path, String.convert_to_snake_case(self._project.name))
if os.path.isdir(project_path) and len(os.listdir(project_path)) > 0:
Console.write_line(project_path)
@ -294,9 +292,6 @@ class NewService(CommandABC):
if self._env.working_directory.endswith(project):
project = ''
if self._workspace is None and self._use_base:
project = f'{self._rel_path}/{project}'
VenvHelper.init_venv(
False,
self._env,
@ -340,9 +335,6 @@ class NewService(CommandABC):
if 'venv' in args:
self._use_venv = True
args.remove('venv')
if 'base' in args:
self._use_base = True
args.remove('base')
console = self._config.get_configuration(ProjectTypeEnum.console.value)
library = self._config.get_configuration(ProjectTypeEnum.library.value)

View File

@ -55,8 +55,7 @@ class StartupArgumentExtension(StartupExtensionABC):
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'startup', ['s', 'S']) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'service-providing', ['sp', 'SP']) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'nothing', ['n', 'N']) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'venv', ['v', 'V']) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'base', ['b', 'B'])
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'venv', ['v', 'V'])
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True, validators=[ProjectValidator])
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True, validators=[WorkspaceValidator]) \
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])

View File

@ -12,7 +12,7 @@ class NewTestCase(unittest.TestCase):
def setUp(self):
os.chdir(os.path.abspath(PLAYGROUND_PATH))
def _test_project(self, project_type: str, name: str, *args, test_venv=False, without_ws=False):
def _test_project(self, project_type: str, name: str, *args, test_venv=False):
CLICommands.new(project_type, name, *args)
workspace_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, name))
self.assertTrue(os.path.exists(workspace_path))
@ -22,15 +22,7 @@ class NewTestCase(unittest.TestCase):
self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv/bin/python')))
self.assertTrue(os.path.islink(os.path.join(workspace_path, 'venv/bin/python')))
base = 'src'
if '--base' in args and '/' in name:
base = name.split('/')[0]
name = name.replace(f'{name.split("/")[0]}/', '')
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, name, base, String.convert_to_snake_case(name)))
if without_ws:
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, base, name, 'src/', String.convert_to_snake_case(name)))
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, name, 'src', String.convert_to_snake_case(name)))
self.assertTrue(os.path.exists(project_path))
self.assertTrue(os.path.join(project_path, f'{name}.json'))
self.assertTrue(os.path.join(project_path, f'main.py'))
@ -62,12 +54,7 @@ class NewTestCase(unittest.TestCase):
self.assertTrue(os.path.exists(os.path.join(workspace_path, 'venv/bin/python')))
self.assertTrue(os.path.islink(os.path.join(workspace_path, 'venv/bin/python')))
base = 'src'
if '--base' in args and '/' in name:
base = name.split('/')[0]
name = name.replace(f'{name.split("/")[0]}/', '')
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, workspace_name, base, String.convert_to_snake_case(name)))
project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, workspace_name, 'src', String.convert_to_snake_case(name)))
self.assertTrue(os.path.exists(project_path))
self.assertTrue(os.path.join(project_path, f'{name}.json'))
os.chdir(os.path.abspath(os.path.join(os.getcwd(), '../')))
@ -101,9 +88,6 @@ class NewTestCase(unittest.TestCase):
def test_console(self):
self._test_project('console', 'test-console', '--ab', '--s', '--venv', test_venv=True)
def test_console_with_other_base(self):
self._test_project('console', 'tools/test-console', '--ab', '--s', '--venv', '--base', test_venv=True, without_ws=True)
def test_console_without_s(self):
self._test_project('console', 'test-console-without-s', '--ab')
@ -116,9 +100,6 @@ class NewTestCase(unittest.TestCase):
def test_sub_console(self):
self._test_sub_project('console', 'test-sub-console', 'test-console', '--ab', '--s', '--sp', '--venv', test_venv=True)
def test_sub_console_with_other_base(self):
self._test_sub_project('console', 'tools/test-sub-console', 'test-console', '--ab', '--s', '--sp', '--venv', '--base', test_venv=True)
def test_library(self):
self._test_project('library', 'test-library', '--ab', '--s', '--sp')