2022.6.17 - Unittests #84
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
import traceback
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from unittests_cli.add_test_case import AddTestCase
|
from unittests_cli.add_test_case import AddTestCase
|
||||||
@ -19,16 +21,44 @@ class CLITestSuite(unittest.TestSuite):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
unittest.TestSuite.__init__(self)
|
unittest.TestSuite.__init__(self)
|
||||||
|
|
||||||
|
self._setup()
|
||||||
|
|
||||||
loader = unittest.TestLoader()
|
loader = unittest.TestLoader()
|
||||||
self.addTests(loader.loadTestsFromTestCase(AddTestCase))
|
# nothing needed
|
||||||
self.addTests(loader.loadTestsFromTestCase(BuildTestCase))
|
|
||||||
self.addTests(loader.loadTestsFromTestCase(GenerateTestCase))
|
self.addTests(loader.loadTestsFromTestCase(GenerateTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(InstallTestCase))
|
|
||||||
self.addTests(loader.loadTestsFromTestCase(NewTestCase))
|
self.addTests(loader.loadTestsFromTestCase(NewTestCase))
|
||||||
|
self.addTests(loader.loadTestsFromTestCase(VersionTestCase))
|
||||||
|
|
||||||
|
# project needed
|
||||||
|
self.addTests(loader.loadTestsFromTestCase(BuildTestCase))
|
||||||
|
self.addTests(loader.loadTestsFromTestCase(InstallTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(PublishTestCase))
|
self.addTests(loader.loadTestsFromTestCase(PublishTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(RemoveTestCase))
|
|
||||||
self.addTests(loader.loadTestsFromTestCase(RunTestCase))
|
self.addTests(loader.loadTestsFromTestCase(RunTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(StartTestCase))
|
self.addTests(loader.loadTestsFromTestCase(StartTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(UninstallTestCase))
|
self.addTests(loader.loadTestsFromTestCase(UninstallTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(UpdateTestCase))
|
self.addTests(loader.loadTestsFromTestCase(UpdateTestCase))
|
||||||
self.addTests(loader.loadTestsFromTestCase(VersionTestCase))
|
|
||||||
|
# workspace needed
|
||||||
|
self.addTests(loader.loadTestsFromTestCase(AddTestCase))
|
||||||
|
self.addTests(loader.loadTestsFromTestCase(RemoveTestCase))
|
||||||
|
|
||||||
|
self._cleanup()
|
||||||
|
|
||||||
|
def _setup(self):
|
||||||
|
try:
|
||||||
|
playground = os.path.abspath(os.path.join(os.getcwd(), 'test_cli_playground'))
|
||||||
|
if os.path.exists(playground):
|
||||||
|
os.rmdir(playground)
|
||||||
|
|
||||||
|
os.mkdir(playground)
|
||||||
|
os.chdir(playground)
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Setup of {__name__} failed: {traceback.format_exc()}')
|
||||||
|
|
||||||
|
def _cleanup(self):
|
||||||
|
try:
|
||||||
|
playground = os.path.abspath(os.path.join(os.getcwd(), 'test_cli_playground'))
|
||||||
|
if os.path.exists(playground):
|
||||||
|
os.rmdir(playground)
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Cleanup of {__name__} failed: {traceback.format_exc()}')
|
||||||
|
Loading…
Reference in New Issue
Block a user