def test_write_v4_archive(self): fp = os.path.join(self.temp_dir.name, 'artifact_v1.qza') with artifact_version(4): artifact = Artifact._from_view(FourInts, [-1, 42, 0, 43], list, self.provenance_capture) artifact.save(fp) root_dir = str(artifact.uuid) expected = { 'VERSION', 'metadata.yaml', 'data/file1.txt', 'data/file2.txt', 'data/nested/file3.txt', 'data/nested/file4.txt', 'provenance/metadata.yaml', 'provenance/VERSION', 'provenance/citations.bib', 'provenance/action/action.yaml', } self.assertArchiveMembers(fp, root_dir, expected) with zipfile.ZipFile(fp, mode='r') as zf: version = zf.read(os.path.join(root_dir, 'VERSION')) self.assertRegex(str(version), '^.*archive: 4.*$')
def test_write_v1_archive(self): fp = os.path.join(self.temp_dir.name, 'artifact_v1.qza') with artifact_version(1): artifact = Artifact._from_view(FourInts, [-1, 42, 0, 43], list, self.provenance_capture) artifact.save(fp) root_dir = str(artifact.uuid) expected = { 'VERSION', 'metadata.yaml', 'data/file1.txt', 'data/file2.txt', 'data/nested/file3.txt', 'data/nested/file4.txt', 'provenance/metadata.yaml', 'provenance/VERSION', 'provenance/action/action.yaml', } self.assertArchiveMembers(fp, root_dir, expected) with zipfile.ZipFile(fp, mode='r') as zf: version = zf.read(os.path.join(root_dir, 'VERSION')) self.assertRegex(str(version), '^.*archive: 1.*$')
def test_checksum_backwards_compat(self): self.tearDown() with artifact_version(4): self.setUp() diff = self.archiver.validate_checksums() self.assertEqual(diff.added, {}) self.assertEqual(diff.removed, {}) self.assertEqual(diff.changed, {})
def test_checksum_backwards_compat(self): self.tearDown() with artifact_version(4): self.setUp() diff = self.archiver.validate_checksums() self.assertEqual(diff.added, {}) self.assertEqual(diff.removed, {}) self.assertEqual(diff.changed, {})
def test_nonexistent_archive_format(self): with self.assertRaisesRegex(ValueError, 'Version foo not supported'): with artifact_version('foo'): pass
def test_nonexistent_archive_format(self): with self.assertRaisesRegex(ValueError, 'Version foo not supported'): with artifact_version('foo'): pass