Skip to content

Commit

Permalink
Merge pull request #1617 from pyiron/add_pack_bc_tests
Browse files Browse the repository at this point in the history
[patch] Add pack backwards compatibility tests
  • Loading branch information
pmrv authored Aug 23, 2024
2 parents 4394b7b + 103302e commit 7ad654a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/static/pack/export.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
,id,status,chemicalformula,job,subjob,project,timestart,timestop,totalcputime,computer,hamilton,hamversion,parentid,masterid
0,0,finished,,toy,/toy,test_pack/my_project,2024-08-22 16:10:26.556984,,,pyiron@7720454e9ac5#1,ToyJob,0.4,,
Binary file added tests/static/pack/test_pack.tar.gz
Binary file not shown.
23 changes: 22 additions & 1 deletion tests/unit/archiving/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pyiron_base import Project
from pandas._testing import assert_frame_equal
from filecmp import dircmp
from shutil import rmtree
from shutil import rmtree, copytree
import tarfile
from pyiron_base._tests import PyironTestCase, ToyJob

Expand Down Expand Up @@ -181,5 +181,26 @@ def test_backwards_compatibility(self):
self.imp_pr.unpack(origin_path=self.arch_dir_comp, csv_file_name="ahoy.csv")


class TestUnpackingBackwardsCompatibility(PyironTestCase):
def test_import_old_tar(self):
copytree(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../../static/pack",
),
os.getcwd(),
dirs_exist_ok=True,
)
pr = Project("old_tar")
pr.unpack(origin_path="test_pack.tar.gz")
job = pr.load("toy")
self.assertEqual(job.job_name, "toy")
self.assertEqual(job.input.data_in, 100)
self.assertEqual(job.output.data_out, 101)
pr.remove(enable=True, enforce=True)
os.remove("test_pack.tar.gz")
os.remove("export.csv")


if __name__ == "__main__":
unittest.main()

0 comments on commit 7ad654a

Please sign in to comment.