diff --git a/testplan/common/entity/base.py b/testplan/common/entity/base.py index a1ebc51e6..11d9bc813 100644 --- a/testplan/common/entity/base.py +++ b/testplan/common/entity/base.py @@ -1678,7 +1678,9 @@ def run(self): break_join=lambda: self.aborted is True, ) if self._runnable.interactive is not None: - return self._runnable.interactive + # for testing purpose + if self.cfg.interactive_block is False: + return self._runnable.interactive if isinstance(self._runnable.result, Exception): raise self._runnable.result return self._runnable.result diff --git a/testplan/runnable/interactive/http.py b/testplan/runnable/interactive/http.py index affa83385..cc2798786 100644 --- a/testplan/runnable/interactive/http.py +++ b/testplan/runnable/interactive/http.py @@ -827,14 +827,23 @@ def _should_run(uid, curr_status, new_status): """ if new_status == curr_status: return False + + # test entry already triggered + elif ( + new_status == RuntimeStatus.RUNNING + and curr_status == RuntimeStatus.WAITING + ): + return False + elif new_status == RuntimeStatus.RUNNING: - if curr_status not in (RuntimeStatus.RESETTING, RuntimeStatus.WAITING): - return True - else: + + if curr_status == RuntimeStatus.RESETTING: raise werkzeug.exceptions.BadRequest( "Cannot update runtime status of entry" f' "{uid}" from "{curr_status}" to "{new_status}"' ) + return True + return False diff --git a/testplan/runnable/interactive/reloader.py b/testplan/runnable/interactive/reloader.py index aeeca0102..dd9a34256 100644 --- a/testplan/runnable/interactive/reloader.py +++ b/testplan/runnable/interactive/reloader.py @@ -198,10 +198,11 @@ def _build_dep_graph(self, main_module_file, reload_dirs): try: with io.open(main_module_file, "r") as fp: text = fp.read() - except OSError: + except OSError as exc: raise RuntimeError( - "Could not run main module {} as a script.".format( - main_module_file + "Could not run main module {} as a script: {}.".format( + main_module_file, + exc, ) ) else: diff --git a/tests/unit/testplan/runnable/interactive/test_api.py b/tests/unit/testplan/runnable/interactive/test_api.py index a72e4f91a..15e138561 100644 --- a/tests/unit/testplan/runnable/interactive/test_api.py +++ b/tests/unit/testplan/runnable/interactive/test_api.py @@ -368,7 +368,9 @@ def test_put_validation(self, api_env): rsp = client.put(api_url, json=json_test) assert rsp.status_code == 200 rsp = client.put(api_url, json=json_test) - assert rsp.status_code == 400 + assert rsp.status_code == 200 + json_rsp = rsp.get_json() + assert json_rsp["runtime_status"] == report.RuntimeStatus.WAITING class TestAllSuites: