Skip to content
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

Fix logging demo test #400

Merged
merged 2 commits into from
Oct 18, 2019
Merged

Fix logging demo test #400

merged 2 commits into from
Oct 18, 2019

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Oct 17, 2019

By relocating output_filter assignment. Running CI for Linux only as changes are cross-platform.

  • Linux Build Status

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@wuffle-ros wuffle-ros bot added the in review Waiting for review (Kanban column) label Oct 17, 2019
@dirk-thomas
Copy link
Member

Can you describe why setUpClass isn't sufficient? Is it not being called?

Also retriggered build passed: Build Status

@hidmic
Copy link
Contributor Author

hidmic commented Oct 17, 2019

Can you describe why setUpClass isn't sufficient? Is it not being called?

At first it wasn't obvious to me either.

But deep down, it's because of this. That patch essentially duplicates test case classes through inheritance to prevent overlap of arguments bound to class methods for launch tests that use parameterization -- there's only one class definition and N different set of arguments to be bound. Now, because of that, when setUpClass() gets called cls becomes that subclass and later attempts to refer to any of the set attributes via the base class fail.

I'm not particularly happy with either change, but I deem this one less harmful. The true problem is that launch_testing parameterization is not correct in this regard. pytest solves this problem in completely different way, by providing "class"-scoped fixtures (see here).

@hidmic
Copy link
Contributor Author

hidmic commented Oct 17, 2019

Or, alternatively, we can forbid launch_testing to bind setUpClass() arguments and change CLI tests accordingly. It doesn't look pretty, that's why it wasn't my first choice.

@@ -38,12 +38,9 @@ def generate_test_description(ready_fn):


class TestLoggingDemo(unittest.TestCase):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to keep this empty line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9056e2d

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Oct 18, 2019

Merging

@hidmic hidmic merged commit 93a4ee2 into master Oct 18, 2019
@delete-merged-branch delete-merged-branch bot deleted the hidmic/fix-logging-demo-test branch October 18, 2019 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants