Improved tests #129
This commit is contained in:
parent
d8f7e03815
commit
e8ae635c88
@ -18,6 +18,6 @@ class Application(ApplicationABC):
|
|||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
runner = unittest.TextTestRunner()
|
runner = unittest.TextTestRunner()
|
||||||
# runner.run(CLITestSuite())
|
runner.run(CLITestSuite())
|
||||||
runner.run(QueryTestSuite())
|
runner.run(QueryTestSuite())
|
||||||
# runner.run(TranslationTestSuite())
|
runner.run(TranslationTestSuite())
|
||||||
|
@ -26,7 +26,10 @@ class AddTestCase(unittest.TestCase):
|
|||||||
return project_json
|
return project_json
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -31,7 +31,10 @@ class BuildTestCase(unittest.TestCase):
|
|||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -75,4 +75,4 @@ class CLITestSuite(unittest.TestSuite):
|
|||||||
def run(self, *args):
|
def run(self, *args):
|
||||||
self._setup()
|
self._setup()
|
||||||
self._result = super().run(*args)
|
self._result = super().run(*args)
|
||||||
# self._cleanup()
|
self._cleanup()
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
PLAYGROUND_PATH = os.path.abspath(os.path.join(os.getcwd(), '../test_cli_playground'))
|
base = ''
|
||||||
TRANSLATION_PATH = os.path.abspath(os.path.join(os.getcwd(), '../unittests_translation'))
|
if not os.getcwd().endswith('unittests'):
|
||||||
CLI_PATH = os.path.abspath(os.path.join(os.getcwd(), '../../src/cpl_cli/main.py'))
|
base = '../'
|
||||||
|
|
||||||
|
PLAYGROUND_PATH = os.path.abspath(os.path.join(os.getcwd(), f'{base}test_cli_playground'))
|
||||||
|
TRANSLATION_PATH = os.path.abspath(os.path.join(os.getcwd(), f'{base}unittests_translation'))
|
||||||
|
CLI_PATH = os.path.abspath(os.path.join(os.getcwd(), f'{base}../src/cpl_cli/main.py'))
|
||||||
|
@ -31,7 +31,10 @@ class InstallTestCase(unittest.TestCase):
|
|||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -10,7 +10,10 @@ from unittests_shared.cli_commands import CLICommands
|
|||||||
class NewTestCase(unittest.TestCase):
|
class NewTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(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, without_ws=False):
|
||||||
CLICommands.new(project_type, name, *args)
|
CLICommands.new(project_type, name, *args)
|
||||||
|
@ -31,7 +31,10 @@ class PublishTestCase(unittest.TestCase):
|
|||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -24,7 +24,10 @@ class RemoveTestCase(unittest.TestCase):
|
|||||||
return project_json
|
return project_json
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -50,7 +50,10 @@ class RunTestCase(unittest.TestCase):
|
|||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -50,7 +50,10 @@ class StartTestCase(unittest.TestCase):
|
|||||||
project_file.close()
|
project_file.close()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -29,7 +29,10 @@ class UninstallTestCase(unittest.TestCase):
|
|||||||
return project_json
|
return project_json
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
os.chdir(os.path.abspath(PLAYGROUND_PATH))
|
if not os.path.exists(PLAYGROUND_PATH):
|
||||||
|
os.makedirs(PLAYGROUND_PATH)
|
||||||
|
|
||||||
|
os.chdir(PLAYGROUND_PATH)
|
||||||
# create projects
|
# create projects
|
||||||
CLICommands.new('console', self._source, '--ab', '--s')
|
CLICommands.new('console', self._source, '--ab', '--s')
|
||||||
os.chdir(os.path.join(os.getcwd(), self._source))
|
os.chdir(os.path.join(os.getcwd(), self._source))
|
||||||
|
@ -25,4 +25,4 @@ class QueryTestSuite(unittest.TestSuite):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
runner = unittest.TextTestRunner()
|
runner = unittest.TextTestRunner()
|
||||||
runner.run(QueryTestSuite())
|
runner.run(QueryTestSuite())
|
||||||
|
Loading…
Reference in New Issue
Block a user