From d83d1a244e6371c0020d52e1c315f7d93a325f6b Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 26 Jun 2022 01:05:45 +0200 Subject: [PATCH] Fixed for start command [WIP] output is needed --- unittests/unittests_cli/cli_test_suite.py | 14 +++++++------- unittests/unittests_cli/start_test_case.py | 8 ++++++-- .../unittests_cli/threads/start_test_thread.py | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/unittests/unittests_cli/cli_test_suite.py b/unittests/unittests_cli/cli_test_suite.py index eea5426e..c615ab5a 100644 --- a/unittests/unittests_cli/cli_test_suite.py +++ b/unittests/unittests_cli/cli_test_suite.py @@ -30,20 +30,20 @@ class CLITestSuite(unittest.TestSuite): active_tests = [ # nothing needed - GenerateTestCase, - NewTestCase, + # GenerateTestCase, + # NewTestCase, # compare console output # VersionTestCase, # project needed - BuildTestCase, - PublishTestCase, - RunTestCase, + # BuildTestCase, + # PublishTestCase, + # RunTestCase, StartTestCase, # check in project settings if package is updated # UpdateTestCase, # workspace needed - AddTestCase, - RemoveTestCase + # AddTestCase, + # RemoveTestCase ] if self._is_online: diff --git a/unittests/unittests_cli/start_test_case.py b/unittests/unittests_cli/start_test_case.py index a0c86a03..f41eb450 100644 --- a/unittests/unittests_cli/start_test_case.py +++ b/unittests/unittests_cli/start_test_case.py @@ -1,6 +1,7 @@ import json import os import shutil +import time import unittest from cpl_core.utils import String @@ -29,7 +30,7 @@ class StartTestCase(unittest.TestCase): settings['RunTest']['WasRestarted'] = 'True' settings['RunTest']['WasStarted'] = 'True' - + with open('appsettings.json', 'w', encoding='utf-8') as project_file: project_file.write(json.dumps(settings, indent=2)) project_file.close() @@ -68,7 +69,8 @@ class StartTestCase(unittest.TestCase): def test_start(self): thread = StartTestThread() - thread.run() + thread.start() + time.sleep(1) settings = self._get_appsettings() self.assertNotEqual(settings, {}) self.assertIn('RunTest', settings) @@ -82,6 +84,8 @@ class StartTestCase(unittest.TestCase): file.write(f'# trigger restart (comment generated by unittest)') file.close() + time.sleep(1) + settings = self._get_appsettings() self.assertNotEqual(settings, {}) self.assertIn('RunTest', settings) diff --git a/unittests/unittests_cli/threads/start_test_thread.py b/unittests/unittests_cli/threads/start_test_thread.py index 1a80b8d1..6c413e6d 100644 --- a/unittests/unittests_cli/threads/start_test_thread.py +++ b/unittests/unittests_cli/threads/start_test_thread.py @@ -9,4 +9,4 @@ class StartTestThread(threading.Thread): threading.Thread.__init__(self, daemon=True) def run(self): - CLICommands.start() + CLICommands.start(True)