Skip to content

RF: Use runtime.cwd in Rename #2688

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

Merged
merged 1 commit into from
Aug 29, 2018
Merged

RF: Use runtime.cwd in Rename #2688

merged 1 commit into from
Aug 29, 2018

Conversation

effigies
Copy link
Member

Summary

Rename calculates the output path twice, in _run_interface and _list_outputs. By moving to SimpleInterface, we can calculate the path once, and use runtime.cwd as insurance against unexpected working directory changes.

Fixes #2687.

List of changes proposed in this PR (pull-request)

  • Add SimpleInterface as mixin to Rename
  • Calculate output path via runtime.cwd

Acknowledgment

  • (Mandatory) I acknowledge that this contribution will be available under the Apache 2 license.

@codecov-io
Copy link

Codecov Report

Merging #2688 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2688      +/-   ##
=========================================
- Coverage    67.6%   67.6%   -0.01%     
=========================================
  Files         340     340              
  Lines       43145   43143       -2     
  Branches     5349    5349              
=========================================
- Hits        29170   29168       -2     
  Misses      13273   13273              
  Partials      702     702
Flag Coverage Δ
#smoketests 50.58% <25%> (ø) ⬆️
#unittests 65.1% <100%> (-0.01%) ⬇️
Impacted Files Coverage Δ
nipype/interfaces/utility/base.py 88.06% <100%> (-0.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b4187c...7aab323. Read the comment docs.

os.path.join(os.getcwd(), self._rename()))
out_file = os.path.join(runtime.cwd, self._rename())
_ = copyfile(self.inputs.in_file, out_file)
self._results['out_file'] = out_file
Copy link
Contributor

@oesteban oesteban Aug 29, 2018

Choose a reason for hiding this comment

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

Now that the constructor of SimpleInterface is not called, then self._results should be initialized in __init__ as an empty dict, shouldn't it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Scratch that, I see that you are actually adding the SimpleInterface. For some reason I read the diff in the opposite way.

@oesteban oesteban merged commit 37f3781 into nipy:master Aug 29, 2018
@effigies effigies deleted the rf/rename branch August 30, 2018 13:14
@effigies effigies added this to the 1.1.3 milestone Aug 30, 2018
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.

3 participants