self.failIf(bar_copy.unique is bar.unique) # Since the two original 'ref' links were to a shared object, # the cloned links should be to a shared object. Also, the shared # object should be the original 'ref' object, since copy was set to # 'ref'. self.failUnless(baz_copy.ref is bar_copy.ref) self.failUnless(bar_copy.ref is ref) # Check references to objects that where cloned, they should reference # the new clones not the original objects, except when copy is set # to 'ref' (as in the case of the 'other' trait). That is, the 'deep' # flag on clone_traits should not override the 'copy' metadata on # the trait. self.failIf(bar_copy.other is baz_copy) self.failUnless(bar_copy.other is baz) # 'shared' does not have copy set to 'ref', and so bar_copy.shared # should reference the new clone. self.failIf(bar_copy.shared is baz.shared) self.failUnless(bar_copy.shared is baz_copy.shared) # # support running this test individually, from the command-line as a script # if __name__ == '__main__': unittest.main() #### EOF ######################################################################
Returns ------- The newly created dir where the new broken egg is copied. Adding this dir to plugin_path will cause VersionConflict on trying to load distributions. """ tmpdir = tempfile.mkdtemp() self.addCleanup(shutil.rmtree, tmpdir) # Copy the egg to the temp dir and rename it eggs = glob.glob(join(self.eggs_dir, egg_pat)) for egg in eggs: egg_name = basename(egg) split_name = egg_name.split("-") if replacement is None: split_name[1] += "1" else: split_name[1] = replacement new_name = "-".join(split_name) shutil.copy(egg, join(tmpdir, new_name)) return tmpdir # Entry point for stand-alone testing. if __name__ == "__main__": unittest.main() #### EOF ######################################################################