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

Bugfix for optional output template files (i.e. of type Union[Path, bool]) when set to False #709

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

tclose
Copy link
Contributor

@tclose tclose commented Sep 29, 2023

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Summary

For options such as the following where an optional output file (with a template) type Union[Path, bool], where the value is set to False, the collection of outputs was failing when attempting to coerce the boolean to a File

(
    "unused",
    attr.ib(
        type=ty.Union[Path, bool],
        default=False,
        metadata={
            "argstr": "--not-used",
            "output_file_template": "out.txt",
            "help_string": "dummy output",
        },
    ),
),

This bug-fix omits these fields from the collected outputs

Checklist

  • [ x ] I have added tests to cover my changes (if necessary)

@tclose tclose changed the title Boolean-outfile-bugfix Optional output files (i.e. inputs with output_file_template and type Union[Path, bool]) bugfix when set to False Sep 29, 2023
@tclose tclose changed the title Optional output files (i.e. inputs with output_file_template and type Union[Path, bool]) bugfix when set to False Bugfix for optional output template files (i.e. of type Union[Path, bool]) when set to False Sep 29, 2023
@tclose tclose added the bug Something isn't working label Sep 29, 2023
@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.65%. Comparing base (1720ba6) to head (87cc499).
Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #709      +/-   ##
==========================================
+ Coverage   83.35%   83.65%   +0.30%     
==========================================
  Files          24       24              
  Lines        4949     4986      +37     
  Branches     1411     1416       +5     
==========================================
+ Hits         4125     4171      +46     
+ Misses        816      809       -7     
+ Partials        8        6       -2     
Flag Coverage Δ
unittests 83.65% <100.00%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

pydra/engine/specs.py Outdated Show resolved Hide resolved
Copy link
Contributor

@effigies effigies left a comment

Choose a reason for hiding this comment

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

This seems to work. I agree it would be good to understand the use case for L462 and either remove or test it.

@ghisvail ghisvail merged commit 0e66136 into nipype:master Mar 1, 2024
43 checks passed
@effigies
Copy link
Contributor

effigies commented Mar 1, 2024

Is one the nested ifs redundant?

@tclose tclose deleted the boolean-outfile-bugfix branch March 17, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants