def test_open(self): pkg_sim = self.simlab.simulate_pkg_assembly_basic() pkg = Pkg(pkg_sim.path) tmp_dir = tempfile.mkdtemp() try: content = pkg.open(tmp_dir) self.assertIsInstance(content, PkgContent) self.assertTrue( os.path.exists(os.path.join(tmp_dir, PKG_META_YML_FILE))) self.assertTrue( os.path.exists(os.path.join(tmp_dir, ASSEMBLY_DESCRIPTOR_DIR))) finally: if os.path.exists(tmp_dir): shutil.rmtree(tmp_dir)
def test_open_pkg_with_deprecated_content_directory(self): pkg_sim = self.simlab.simulate_pkg_assembly_deprecated_content_basic() pkg = Pkg(pkg_sim.path) tmp_dir = tempfile.mkdtemp() try: content = pkg.open(tmp_dir) self.assertIsInstance(content, PkgContent) # Pkg opened in content directory self.assertEqual(content.tree.root_path, os.path.join(tmp_dir, PKG_DEPRECATED_CONTENT_DIR)) # Pkg meta file still reachable self.assertTrue( os.path.exists( os.path.join(content.tree.root_path, PKG_META_YML_FILE))) self.assertTrue( os.path.exists( os.path.join(content.tree.root_path, ASSEMBLY_DESCRIPTOR_DIR))) finally: if os.path.exists(tmp_dir): shutil.rmtree(tmp_dir)