-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Generalize output checking tools. - Ease process launch and interaction. - Fix parameterization support. - Fix pytest hooks. Signed-off-by: Michel Hidalgo <[email protected]>
- Loading branch information
Showing
16 changed files
with
620 additions
and
137 deletions.
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
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,44 @@ | ||
# Copyright 2019 Open Source Robotics Foundation, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import functools | ||
import inspect | ||
|
||
|
||
def keep_alive(test_description): | ||
"""Mark a test launch description to be kept alive after fixture processes' termination.""" | ||
if not hasattr(test_description, '__markers__'): | ||
test_description.__markers__ = {} | ||
test_description.__markers__['keep_alive'] = True | ||
return test_description | ||
|
||
|
||
def retry_on_failure(*, times): | ||
"""Mark a test case to be retried up to `times` on AssertionError.""" | ||
assert times > 0 | ||
|
||
def _decorator(func): | ||
@functools.wraps(func) | ||
def _wrapper(*args, **kwargs): | ||
n = times | ||
while n > 1: | ||
try: | ||
return func(*args, **kwargs) | ||
except AssertionError: | ||
n -= 1 | ||
return func(*args, **kwargs) | ||
# Keep signature for argument binding | ||
_wrapper.__signature__ = inspect.signature(func) | ||
return _wrapper | ||
return _decorator |
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.