Skip to content

Commit

Permalink
Remove deprecated support for implicit mkdir in sunsch (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
berland authored Jan 3, 2024
1 parent 16b8d8c commit 6c42a88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/subscript/sunsch/sunsch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import sys
import tempfile
import textwrap
import warnings
from pathlib import Path
from typing import List, Union

Expand Down Expand Up @@ -753,13 +752,7 @@ def main():
logger.info("Writing Eclipse deck to %s", str(config.snapshot.output))
dirname = Path(config.snapshot.output).parent
if dirname and not dirname.exists():
warnings.warn(
f"Implicit mkdir of directory {str(dirname)} is deprecated and "
f"will be removed later. Please ensure {str(dirname)} exists before "
"calling sunsch.",
FutureWarning,
)
dirname.mkdir()
raise OSError(f"The directory {dirname} does not exist")
Path(config.snapshot.output).write_text(schedule, encoding="utf8")


Expand Down
4 changes: 2 additions & 2 deletions tests/test_sunsch.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def test_cmdline_output(testdata, mocker):
mocker.patch(
"sys.argv", ["sunsch", "--output", "subdir/schedule.inc", "config_v2.yml"]
)
with pytest.warns(FutureWarning, match="Implicit mkdir"):
sunsch.main()
Path("subdir").mkdir()
sunsch.main()
assert Path("subdir/schedule.inc").exists()


Expand Down

0 comments on commit 6c42a88

Please sign in to comment.