def test_extract(self): pkg_sim = self.simlab.simulate_pkg_assembly_basic() pkg = Pkg(pkg_sim.path) tmp_dir = tempfile.mkdtemp() try: pkg.extract(tmp_dir) 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_extract_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: pkg.extract(tmp_dir) self.assertTrue( os.path.exists(os.path.join(tmp_dir, PKG_META_YML_FILE))) # Content nested under a "content" directory self.assertTrue( os.path.exists( os.path.join(tmp_dir, PKG_DEPRECATED_CONTENT_DIR))) self.assertFalse( os.path.exists(os.path.join(tmp_dir, ASSEMBLY_DESCRIPTOR_DIR))) self.assertTrue( os.path.exists( os.path.join(tmp_dir, PKG_DEPRECATED_CONTENT_DIR, ASSEMBLY_DESCRIPTOR_DIR))) finally: if os.path.exists(tmp_dir): shutil.rmtree(tmp_dir)