Skip to content

Commit b9d57b3

Browse files
committed
-
1 parent 360e88a commit b9d57b3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ coverage.xml
1717
*.coverage
1818
.coverage_html_report
1919

20-
_build
20+
_build
21+
22+
__pycache__

source_py3/python_toolbox/temp_file_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ def create_temp_folder(suffix='', prefix=tempfile.template):
3434
Use the `suffix` and `prefix` string arguments to dictate a suffix and/or a
3535
prefix to the temporary folder's name in the filesystem.
3636
'''
37-
yield pathlib.Path(tempfile.mkdtemp(suffix=suffix, prefix=prefix))
38-
shutil.rmtree(self.path)
37+
temp_folder = pathlib.Path(tempfile.mkdtemp(suffix=suffix, prefix=prefix))
38+
yield temp_folder
39+
shutil.rmtree(str(temp_folder))

source_py3/test_python_toolbox/test_temp_file_tools/test_temporary_folder.py renamed to source_py3/test_python_toolbox/test_temp_file_tools/test_create_temp_folder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
def test_basic():
18-
with () as tf1:
18+
with create_temp_folder() as tf1:
1919
assert isinstance(tf1, pathlib.Path)
2020
assert tf1.exists()
2121
assert tf1.is_dir()

0 commit comments

Comments
 (0)