Skip to content

Commit 3007885

Browse files
author
Alistair Turnbull
committed
Make $outputpath an error if it occurs in a filename (fix #30)
1 parent f954580 commit 3007885

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

nancy/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,7 @@ def outputpath(self, args: Optional[list[bytes]], input: Optional[bytes]) -> byt
458458
raise ValueError("$outputpath does not take arguments")
459459
if input is not None:
460460
raise ValueError("$outputpath does not take an input")
461-
try:
462-
return bytes(self._expand.output_file())
463-
except ValueError:
464-
return b""
461+
return bytes(self._expand.output_file())
465462

466463
def expand(self, args: Optional[list[bytes]], input: Optional[bytes]) -> bytes:
467464
if args is not None:

tests/test_nancy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ def test_path_in_filename() -> None:
134134

135135
def test_outputpath_in_filename() -> None:
136136
with chdir(tests_dir):
137-
passing_test(["outputpath-in-filename-src"], "outputpath-in-filename-expected")
137+
failing_test(
138+
["outputpath-in-filename-src"],
139+
"$outputfile is not available while expanding the filename",
140+
)
138141

139142

140143
def test_realpath_in_dirname_gives_an_error() -> None:

0 commit comments

Comments
 (0)