-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/skip remaining tests being executed #1029
Merged
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5759c88
some primitive ideas
zhenyu-ms 95ee600
Merge branch 'main' into skip-remaining
zhenyu-ms 265257b
test and tweak for config & status enums
zhenyu-ms 8332640
refine selector & local runner
zhenyu-ms 9790560
Merge branch 'main' into skip-remaining
zhenyu-ms e93cf3b
address comments; upgrade tests
zhenyu-ms 6cf423c
some adjustments
zhenyu-ms 2f0fe1a
Merge branch 'main' into skip-remaining
zhenyu-ms 288af8e
some fixes
zhenyu-ms f0dee31
change on locks and flags
zhenyu-ms 51a11fd
address more review comments
zhenyu-ms 609a138
newsfrag, doc & wording adjustment
zhenyu-ms 007eedf
Merge branch 'main' into skip-remaining
zhenyu-ms 0c930c8
minor fixes
zhenyu-ms fc2fba6
Merge branch 'main' into skip-remaining
zhenyu-ms 08bdb98
update newsfrag & log message
zhenyu-ms dce3a7d
Merge branch 'main' into skip-remaining
zhenyu-ms 7321540
Merge branch 'main' into skip-remaining
zhenyu-ms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Added a new command line argument ``--skip-remaining``, a new argument ``skip_strategy`` to MultiTest, allowing certain test execution being skipped for a better user experience. | ||
|
||
Argument ``uid`` of :py:meth:`Testplan.add_resource <testplan.base.Testplan.add_resource>` should match the uid of the ``resource`` argument. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
from collections import OrderedDict, deque | ||
from contextlib import suppress | ||
from typing import ( | ||
Any, | ||
Callable, | ||
Deque, | ||
Dict, | ||
|
@@ -20,20 +21,19 @@ | |
Optional, | ||
Tuple, | ||
Union, | ||
Any, | ||
) | ||
|
||
import psutil | ||
from schema import Or | ||
|
||
from testplan.common.config import Config, ConfigOption | ||
from testplan.common.report.base import EventRecorder | ||
from testplan.common.utils import logger | ||
from testplan.common.utils.path import default_runpath, makedirs, makeemptydirs | ||
from testplan.common.utils.strings import slugify, uuid4 | ||
from testplan.common.utils.thread import execute_as_thread, interruptible_join | ||
from testplan.common.utils.timing import wait | ||
from testplan.common.utils.validation import is_subclass | ||
from testplan.common.report.base import EventRecorder | ||
|
||
|
||
class Environment: | ||
|
@@ -149,6 +149,9 @@ def __repr__(self): | |
def __len__(self): | ||
return len(self._resources) | ||
|
||
def items(self): | ||
return self._resources.items() | ||
|
||
def all_status(self, target) -> bool: | ||
""" | ||
Checks whether all resources have target status. | ||
|
@@ -165,7 +168,7 @@ def _record_resource_exception(self, message, resource, msg_store): | |
fetch_msg = "\n".join(resource.fetch_error_log()) | ||
|
||
msg = message.format( | ||
resource_name=resource.cfg.name, | ||
resource=str(resource), | ||
traceback_exc=traceback.format_exc(), | ||
fetch_msg=fetch_msg, | ||
) | ||
|
@@ -186,7 +189,8 @@ def start(self): | |
resource.start() | ||
except Exception: | ||
self._record_resource_exception( | ||
message="While starting resource [{resource_name}]\n{traceback_exc}\n{fetch_msg}", | ||
message="While starting resource {resource}:\n" | ||
"{traceback_exc}\n{fetch_msg}", | ||
resource=resource, | ||
msg_store=self.start_exceptions, | ||
) | ||
|
@@ -207,7 +211,8 @@ def start(self): | |
resource.wait(resource.STATUS.STARTED) | ||
except Exception: | ||
self._record_resource_exception( | ||
message="While waiting for resource [{resource_name}] to start\n{traceback_exc}\n{fetch_msg}", | ||
message="While waiting for resource {resource} to start:\n" | ||
"{traceback_exc}\n{fetch_msg}", | ||
resource=resource, | ||
msg_store=self.start_exceptions, | ||
) | ||
|
@@ -273,7 +278,8 @@ def stop(self, is_reversed=False): | |
resource.stop() | ||
except Exception: | ||
self._record_resource_exception( | ||
message="While stopping resource [{resource_name}]\n{traceback_exc}\n{fetch_msg}", | ||
message="While stopping resource {resource}:" | ||
"\n{traceback_exc}\n{fetch_msg}", | ||
resource=resource, | ||
msg_store=self.stop_exceptions, | ||
) | ||
|
@@ -596,8 +602,7 @@ def abort(self): | |
|
||
self._should_abort = True | ||
for dep in self.abort_dependencies(): | ||
if dep is not None: | ||
self._abort_entity(dep) | ||
self._abort_entity(dep) | ||
|
||
self.logger.info("Aborting %s", self) | ||
self.aborting() | ||
|
@@ -631,7 +636,6 @@ def _abort_entity(self, entity, wait_timeout=None): | |
self.logger.error(traceback.format_exc()) | ||
self.logger.error("Exception on aborting %s - %s", entity, exc) | ||
else: | ||
|
||
if ( | ||
wait( | ||
predicate=lambda: entity.aborted is True, | ||
|
@@ -640,7 +644,11 @@ def _abort_entity(self, entity, wait_timeout=None): | |
) | ||
is False | ||
): | ||
self.logger.error("Timeout on waiting to abort %s.", entity) | ||
self.logger.error( | ||
"Timeout on waiting to abort %s after %d seconds.", | ||
entity, | ||
timeout, | ||
) | ||
|
||
def aborting(self): | ||
""" | ||
|
@@ -1000,6 +1008,7 @@ def _post_run_checks(self, start_threads, start_procs): | |
:param start_procs: processes before run | ||
:type start_procs: ``list`` of ``Process`` | ||
""" | ||
# XXX: do we want to suppress process/thread check for tests? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does XXX mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i use XXX for something that's not TODO and not FIXME and not NOTE suppression is from intuition, use XXX instead of FIXME here |
||
end_threads = threading.enumerate() | ||
if start_threads != end_threads: | ||
new_threads = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow early return of test execution and skip remaining Testcases/Testsuites/Multitests being executed when a Testcase has failed or raised exception.