Skip to content

Commit

Permalink
Fixing issue where case mistakenly made absolute paths relative (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntouran committed Oct 3, 2022
1 parent 6557412 commit 7be2ad9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion armi/cases/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,8 @@ def copyInterfaceInputs(
try:
if path.is_absolute() and path.exists() and path.is_file():
# Path is absolute, no settings modification or filecopy needed
pass
newFiles.append(path)
continue
except OSError:
pass
# Attempt to construct an absolute file path
Expand Down
14 changes: 14 additions & 0 deletions armi/cases/tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,20 @@ def test_copyInterfaceInputs_relPath(self):
newFilepath = os.path.join(newDir.destination, shuffleFile)
self.assertEqual(newSettings[testSetting], newFilepath)

def test_copyInterfaceInputs_absPath(self):
testSetting = "shuffleLogic"
cs = settings.Settings(ARMI_RUN_PATH)
shuffleFile = cs[testSetting]
absFile = os.path.dirname(os.path.abspath(ARMI_RUN_PATH))
absFile = str(os.path.join(absFile, os.path.basename(shuffleFile)))
cs = cs.modified(newSettings={testSetting: absFile})

with directoryChangers.TemporaryDirectoryChanger() as newDir:
newSettings = cases.case.copyInterfaceInputs(
cs, destination=newDir.destination
)
self.assertEqual(str(newSettings[testSetting]), absFile)


if __name__ == "__main__":
unittest.main()

0 comments on commit 7be2ad9

Please sign in to comment.