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 broken argument parser test #56

Merged
merged 2 commits into from
Oct 31, 2023
Merged

Fix broken argument parser test #56

merged 2 commits into from
Oct 31, 2023

Conversation

jeremykubica
Copy link

Use parse_known_args instead of parse_args so the coverage tests do not fail. parse_known_args returns a tuple of (known, unknown) args, so we take the first element of that tuple.

@@ -11,7 +11,7 @@

def test_make_inference_arg_parser():
parser = make_inference_arg_parser()
args = parser.parse_args()
args = parser.parse_known_args()[0]

Choose a reason for hiding this comment

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

I think you could test this by passing in the command line arguments to parse explicitly. This way, you could test different inputs without needing to run from the command line (and ignore any other conflicting arguments from the pytest invocation). Something like parser.parse_args([]).

Then if you wanted to test specific inputs you'd do something like parser.parse_args(["--flag", "test_value"])

Copy link
Author

Choose a reason for hiding this comment

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

Changed to match your suggestion.

Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 151 lines in your changes are missing coverage. Please review.

Comparison is base (4bd628c) 1.23% compared to head (f302ef4) 4.97%.
Report is 34 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##            main     #56      +/-   ##
========================================
+ Coverage   1.23%   4.97%   +3.73%     
========================================
  Files         19      19              
  Lines       2908    3056     +148     
========================================
+ Hits          36     152     +116     
- Misses      2872    2904      +32     
Files Coverage Δ
src/deepdisc/data_format/file_io.py 100.00% <100.00%> (ø)
src/deepdisc/data_format/register_data.py 100.00% <100.00%> (+100.00%) ⬆️
src/deepdisc/utils/parse_arguments.py 100.00% <100.00%> (+100.00%) ⬆️
src/deepdisc/inference/predictors.py 0.00% <0.00%> (ø)
src/deepdisc/data_format/image_readers.py 75.40% <75.40%> (ø)
src/deepdisc/inference/match_objects.py 0.00% <0.00%> (ø)
src/deepdisc/model/loaders.py 0.00% <0.00%> (ø)
src/deepdisc/model/models.py 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeremykubica jeremykubica merged commit c4a3d1f into main Oct 31, 2023
4 of 5 checks passed
@jeremykubica jeremykubica deleted the test_fix branch October 31, 2023 15:19
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