Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

[rostest] Add test node if topic message is published at least once#863

Merged
dirk-thomas merged 5 commits intoros:kinetic-develfrom
wkentaro:publishtest
Aug 30, 2016
Merged

[rostest] Add test node if topic message is published at least once#863
dirk-thomas merged 5 commits intoros:kinetic-develfrom
wkentaro:publishtest

Conversation

@wkentaro
Copy link
Copy Markdown
Contributor

@wkentaro wkentaro commented Aug 11, 2016

Why

To serve a reusable test node for topics which has unstable topic hz, or latched.

@wkentaro wkentaro force-pushed the publishtest branch 2 times, most recently from 172f4f5 to 1160214 Compare August 11, 2016 18:16
@dirk-thomas
Copy link
Copy Markdown
Member

Please add more information to the pull request describing what the purpose of this new test is. On a first look it seems several already existing tests do cover pub / sub behavior.

@wkentaro
Copy link
Copy Markdown
Contributor Author

Updated the information.

else:
return False
else:
return None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please simplify this block of 12 lines to something shorter like this:

if self.msg:
    return not self.negative
if rospy.Time.now() > self.deadline:
    return self.negative
return None

@wkentaro
Copy link
Copy Markdown
Contributor Author

Fixed.

for param in params:
if 'name' not in param:
rospy.logerr("'name' field is required but not specified.")
sys.exit(1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think the test should ever call exit. Instead it should mark the test as failed using self.fail(...).

Same below.

@wkentaro
Copy link
Copy Markdown
Contributor Author

Fixed.

@dirk-thomas
Copy link
Copy Markdown
Member

Thank you for the patch and iterating on it.

@dirk-thomas dirk-thomas merged commit c37ce07 into ros:kinetic-devel Aug 30, 2016
@wkentaro wkentaro deleted the publishtest branch August 30, 2016 18:11
@wkentaro
Copy link
Copy Markdown
Contributor Author

Thanks.

@130s
Copy link
Copy Markdown
Member

130s commented Feb 17, 2017

@wkentaro mind adding doc at http://wiki.ros.org/rostest/Nodes?

@wkentaro
Copy link
Copy Markdown
Contributor Author

@130s I updated: http://wiki.ros.org/rostest/Nodes#publishtest

@130s
Copy link
Copy Markdown
Member

130s commented Feb 18, 2017

@wkentaro Thanks! This already helped my project.
I've updated the wiki a little. I assumed using rosparam tag is required (i.e. no param tag).

@wkentaro
Copy link
Copy Markdown
Contributor Author

wkentaro commented Feb 18, 2017 via email

from nose.tools import assert_true

import rospy
import rostopic
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This package does not depend on rostopic (and it can't do so since rostopic already depends on rostest). So it can't be ensured that rostopic is being present when trying to use this node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So maybe one solution is we move this testing node to rostopic?
And add a warning if people use publishtest in rostest.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So maybe one solution is we move this testing node to rostopic?

The problem with the test is being worked around in #1601.

And add a warning if people use publishtest in rostest.

I don't think there should be a warning added. It would be better to move the script to a place where it can declare its dependencies correctly. But since existing code might rely on its current location I am not sure what a backward compatible solution would look like.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants