-
Notifications
You must be signed in to change notification settings - Fork 50
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
Migrate launch tests to new launch_testing features & API #340
Conversation
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
56e9ef9
to
f23ba1d
Compare
It might be worth declaring the tests with proc_info/proc_output as an argument. That works as well as referencing the magic local field self.proc_info/self.proc_output like: def test_@TEST_NUM_NODES@_nodes(self, proc_info):
launch_testing.asserts.assertExitCodes(proc_info) I added proc_info and proc_output to the test class before your suggestion to use arguments for the context returned from the test description (I like how you're using locals() in the test description, btw). It's something I was considering deprecating because passing as arguments feels so much cleaner. |
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
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.
Looks good. Just a couple nitpicks.
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.
LGTM with green CI
} | ||
finally: | ||
node.destroy_node() | ||
TEST_CASES = { |
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.
Probably out of the scope of this PR, but IMHO this migrated test looks a little difficult to read. I mean, I needed to read the comments in launch/launch_testing/example_test_context.test.py
to understand what was happening here (maybe, there is better documentation somewhere).
Passing test argument in the returned test context it's not quite intuitive. Also, it would be nice to have better parameterization support.
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.
I know it's hard to read, I did my best to not split it up while keeping some of the unittest
like structure. Alternatively, we could partially recreate what pytest
does with decorators to inject the test functions like it used to be but it seemed a bit too much for a migration.
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Connected to ros2/launch#208.