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

Tools: extract_param_defaults can now also extract 'values' and 'non_… #26579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amilcarlucas
Copy link
Contributor

…default_values'

Also rename a bit to make it more generic

@amilcarlucas amilcarlucas force-pushed the pr-extract-non-default-params branch from c900b1b to aea2f8d Compare March 21, 2024 21:58
Tools/autotest/unittest/extract_param_defaults_unittest.py Outdated Show resolved Hide resolved
if hasattr(m, 'Value') and hasattr(m, 'Default') and m.Value != m.Default:
values[pname] = m.Value
else:
raise SystemExit("Invalid type %s" % type)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not ValueError?

Copy link
Contributor Author

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, \
Copy link
Contributor

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...

Copy link
Contributor Author

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')
Copy link
Contributor

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_valuesas a separate call.

Copy link
Contributor Author

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

@amilcarlucas amilcarlucas force-pushed the pr-extract-non-default-params branch from aea2f8d to 13b1fd5 Compare June 19, 2024 07:23
…default_values'

Also rename a bit to make it more generic
@amilcarlucas amilcarlucas force-pushed the pr-extract-non-default-params branch from ef1ddb6 to c7f6357 Compare June 19, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants