def test_error(): diff(patch_file, orig_dir, new_dir) # Invalid patched dir try: patch(patch_file, bad_orig_dir, tmp_dir) except InvalidOriginalFile, e: str(e) pass
def test_basic(): def dummy_start(stage, length): pass def dummy_progress(index): pass diff(patch_file, orig_dir, new_dir) patch(patch_file, orig_dir, tmp_dir, dummy_start, dummy_progress) compare_directories(new_dir, tmp_dir)
def run(self): old_path = self.prepare_image(self.from_version) new_path = self.prepare_image(self.to_version) print "creating patch %s > %s" % (self.from_version, self.to_version) if not isdir(self.patches_subdir): os.mkdir(self.patches_subdir) diff(join(self.patches_subdir, "%s-r%s-r%s%s" % (self.prefix, self.from_version, self.to_version, self.suffix)), old_path, new_path)
def test_new_files(): diff(patch_file, orig_dir, new_dir) patch(patch_file, orig_with_new_dir, tmp_dir) assert isfile(join(tmp_dir, "new_file")) assert isfile(join(tmp_dir, "new_dir", "new_file_2"))