-
Notifications
You must be signed in to change notification settings - Fork 277
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
Adds a warning if the Server
method of a TestFixture
is called before Finalize
#2047
Adds a warning if the Server
method of a TestFixture
is called before Finalize
#2047
Conversation
before `Finalize This commit adds a warning if someone were to call `Server()` before `Finalize`. The rationale for this is because I made the mistake of not calling `Finalize` ina program I was writing. It took me some time to track down the root cause of the problem. I figure if we warn users it should be immediately obvious. Signed-off-by: Arjo Chakravarty <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-gazebo3 #2047 +/- ##
===============================================
+ Coverage 70.73% 70.77% +0.03%
===============================================
Files 262 262
Lines 16760 16764 +4
===============================================
+ Hits 11856 11865 +9
+ Misses 4904 4899 -5
|
@@ -210,6 +210,13 @@ TestFixture &TestFixture::OnPostUpdate(std::function<void( | |||
////////////////////////////////////////////////// | |||
std::shared_ptr<Server> TestFixture::Server() const | |||
{ | |||
if (!this->dataPtr->finalized) | |||
{ | |||
ignwarn << "Fixture has not been finalized, any functions you attempted" |
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.
Can we use gzwarn
instead to make forward porting easier?
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 don't think gzwarn
is available in citadel. It might be worth considering back porting the functionality to reduce the maintenance overhead.
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.
It's not. If we go ahead and do the forward port while it's "fresh" we can minimize some pain
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.
Ah, sorry. For some reason I thought they were. @mjcarroll would there be an issue if we added those to gz-common3 at some point?
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Summary
This PR adds a warning if someone were to call
Server()
beforeFinalize
. The rationale for this is because I made the mistake of not callingFinalize
ina program I was writing. It took me some time to track down the root cause of the problem. I figure if we warn users it should be immediately obvious.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.