-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Tools: extract_param_defaults can now also extract 'values' and 'non_… #26579
base: master
Are you sure you want to change the base?
Tools: extract_param_defaults can now also extract 'values' and 'non_… #26579
Conversation
c900b1b
to
aea2f8d
Compare
if hasattr(m, 'Value') and hasattr(m, 'Default') and m.Value != m.Default: | ||
values[pname] = m.Value | ||
else: | ||
raise SystemExit("Invalid type %s" % type) |
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.
Why not ValueError
?
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 plan to exit and not have a cryptic backtrace
@@ -10,7 +10,7 @@ | |||
|
|||
import unittest | |||
from unittest.mock import patch, MagicMock | |||
from extract_param_defaults import extract_parameter_default_values, missionplanner_sort, \ | |||
from extract_param_defaults import extract_parameter_values, missionplanner_sort, \ |
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.
Presumably we're missing a test for this new functionality here...
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.
Yes, I did not add any new tests for the new functionality yet.
@@ -71,7 +71,7 @@ def test_logfile_does_not_exist(self, mock_mavlink_connection): | |||
|
|||
# Call the function with a dummy logfile path | |||
with self.assertRaises(SystemExit) as cm: | |||
extract_parameter_default_values('dummy.bin') | |||
extract_parameter_values('dummy.bin') |
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.
This is awkward. You haven't added the keyword argument here, so this doesn't actually get the parameter values, does it? It gets the default values?
Might I suggest adding an entry point to the library instead?
So leave extract_parameter_default_values
and add extract_parameter_values
as a separate call.
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.
The default is to test default values
aea2f8d
to
13b1fd5
Compare
…default_values' Also rename a bit to make it more generic
ef1ddb6
to
c7f6357
Compare
…default_values'
Also rename a bit to make it more generic