-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #543 from render-engine:531-AttributeError-str-obj…
…ect-has-no-attribute-exists Fix clean folder function
- Loading branch information
Showing
2 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pathlib | ||
import pytest | ||
from render_engine.cli.cli import remove_output_folder | ||
|
||
from render_engine.site import Site | ||
|
||
def test_clean_folder(tmp_path): | ||
site = Site() | ||
site.output_path = tmp_path | ||
dirty_output_path = tmp_path / "test" # Tests that nested folders are also removed | ||
dirty_output_path.mkdir() | ||
dirty_output_path.joinpath("test.txt").touch() | ||
assert dirty_output_path.exists() | ||
|
||
remove_output_folder(pathlib.Path(dirty_output_path)) | ||
assert not dirty_output_path.exists() | ||
assert not list(tmp_path.iterdir()) |