-
Notifications
You must be signed in to change notification settings - Fork 76
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
Support launch_ros test runner in pytest #54
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7135b32
Support launch_ros test runner in pytest.
hidmic 68f7d32
Test examples using pytest
hidmic 44f8194
Improve pytest rostest marker documentation.
hidmic 7983a7b
Move examples README to the root.
hidmic e0c3c01
Remove single marker constraint for generate_test_description functions.
hidmic a77890c
Please flake8
hidmic ef7474c
Install examples properly.
hidmic 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# launch\_testing\_ros | ||
|
||
## Examples | ||
|
||
### `talker_listener_launch_test.py` | ||
|
||
Usage: | ||
|
||
```sh | ||
launch_test test/examples/talker_listener_launch_test.py | ||
``` | ||
|
||
This test launches the talker and listener example nodes from demo\_nodes\_py and interacts | ||
with them via their ROS interfaces. Remapping rules are used so that one of the tests can sit in | ||
between the talker and the listener and change the data on the fly. | ||
|
||
#### test\_fuzzy\_data | ||
This test gives an example of what a test that fuzzes data might look like. A ROS subscriber | ||
and publisher pair encapsulated in a `DataRepublisher` object changes the string "Hello World" to | ||
"Aloha World" as it travels between the talker and the listener. | ||
|
||
#### test\_listener\_receives | ||
This test publishes unique messages on the `/chatter` topic and asserts that the same messages | ||
go to the stdout of the listener node | ||
|
||
#### test\_talker\_transmits | ||
This test subscribes to the remapped `/talker_chatter` topic and makes sure the talker node also | ||
writes the data it's transmitting to stdout |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
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,43 @@ | ||
# 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. | ||
|
||
from launch_testing.pytest.hooks import LaunchTestItem | ||
from launch_testing.pytest.hooks import LaunchTestModule | ||
|
||
from ..test_runner import LaunchTestRunner | ||
|
||
|
||
class LaunchROSTestItem(LaunchTestItem): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs, runner_cls=LaunchTestRunner) | ||
|
||
|
||
class LaunchROSTestModule(LaunchTestModule): | ||
|
||
def makeitem(self, *args, **kwargs): | ||
return LaunchROSTestItem(*args, **kwargs) | ||
|
||
|
||
def pytest_launch_collect_makemodule(path, parent, entrypoint): | ||
marks = getattr(entrypoint, 'pytestmark', []) | ||
if marks and any(m.name == 'rostest' for m in marks): | ||
return LaunchROSTestModule(path, parent) | ||
|
||
|
||
def pytest_configure(config): | ||
config.addinivalue_line( | ||
'markers', | ||
'rostest: mark a generate_test_description function as a ROS launch test entrypoint' | ||
) |
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.
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.
New sentence should start on new line.
Same below.
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.
Oops. It predates the PR but you're right.