Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[patch] Use tempfile instead of creating a directory" #1556

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions tests/unit/archiving/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pandas._testing import assert_frame_equal
from filecmp import dircmp
import shutil
import tempfile
from pyiron_base._tests import PyironTestCase, ToyJob


Expand Down Expand Up @@ -75,23 +74,23 @@ def test_content(self):
self.assertEqual(len(compare_obj.diff_files), 0)

def test_export_with_targz_extension(self):
with tempfile.TemporaryDirectory() as temp_dir:
tmp_path = os.path.abspath(os.path.join(os.curdir, temp_dir))
tar_arch = self.arch_dir_comp + ".tar.gz"
self.pr.pack(
destination_path=os.path.join(tmp_path, tar_arch),
csv_file_name=os.path.join(tmp_path, "exported.csv"),
compress=True,
)
desirable_lst = [tar_arch, "exported.csv"]
desirable_lst.sort()
content_tmp = os.listdir(tmp_path)
content_tmp.sort()
try:
shutil.rmtree(tmp_path)
except Exception as err_msg:
print(f"deleting unsuccessful: {err_msg}")
self.assertListEqual(desirable_lst, content_tmp)
os.makedirs(os.path.join(os.curdir, "tmp"))
tmp_path = os.path.abspath(os.path.join(os.curdir, "tmp"))
tar_arch = self.arch_dir_comp + ".tar.gz"
self.pr.pack(
destination_path=os.path.join(tmp_path, tar_arch),
csv_file_name=os.path.join(tmp_path, "exported.csv"),
compress=True,
)
desirable_lst = [tar_arch, "exported.csv"]
desirable_lst.sort()
content_tmp = os.listdir(tmp_path)
content_tmp.sort()
try:
shutil.rmtree(tmp_path)
except Exception as err_msg:
print(f"deleting unsuccessful: {err_msg}")
self.assertListEqual(desirable_lst, content_tmp)

@patch("os.makedirs")
@patch("shutil.copy2")
Expand Down
Loading