Skip to content

Commit

Permalink
Revert output naming change
Browse files Browse the repository at this point in the history
  • Loading branch information
tuncbkose committed Apr 12, 2023
1 parent ee04432 commit 8fa6733
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nbconvert/nbconvertapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def write_single_notebook(self, output, resources):
raise KeyError(msg)

notebook_name = resources["unique_key"]
if self.use_output_suffix:
if self.use_output_suffix and self.output_base == "{notebook_name}":
notebook_name += resources.get("output_suffix", "")

write_results = self.writer.write(output, resources, notebook_name=notebook_name)
Expand Down
11 changes: 9 additions & 2 deletions nbconvert/tests/test_nbconvertapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,17 @@ def test_output_base(self):
self.nbconvert("*.ipynb --output notebook_test_name --to markdown")

# Test single output with static output name
with self.create_temp_cwd([notebook_names[0] + ".ipynb"]):
self.nbconvert("*.ipynb --output notebook_test_name --to markdown")
nbname = notebook_names[0]
with self.create_temp_cwd([nbname + ".ipynb"]):
self.nbconvert(f"{nbname}.ipynb --output notebook_test_name --to markdown")
assert os.path.isfile("notebook_test_name.md")

self.nbconvert(f"{nbname}.ipynb --to notebook")
assert os.path.isfile("notebook1.nbconvert.ipynb")

self.nbconvert(f"{nbname}.ipynb --to notebook --output out.ipynb")
assert os.path.isfile("out.ipynb")

# Test double extension fix
with self.create_temp_cwd([notebook_names[0] + ".ipynb"]):
self.nbconvert("*.ipynb --output notebook_test_name.md --to markdown")
Expand Down

0 comments on commit 8fa6733

Please sign in to comment.