def setUp(self): if os.path.exists(self.tagged): shutil.rmtree(self.tagged) if os.path.exists(self.package_name): symlink_support.remove_symlink(self.package_name) self.orig_sys_path = sys.path[:] # create a sample package; imagine you have a package with a tag and # you want to symbolically link it from its untagged name. os.mkdir(self.tagged) init_file = os.path.join(self.tagged, '__init__.py') open(init_file, 'w').close() assert os.path.exists(init_file) # now create a symlink to the tagged package # sample -> sample-tagged symlink_support.symlink(self.tagged, self.package_name) assert os.path.isdir(self.package_name) assert os.path.isfile(os.path.join(self.package_name, '__init__.py'))