def test_possible(self): result = ManyResult() result.success.append((FixerResult("Do bla", ["tag-a"], "possible"), "summary")) result.success.append((FixerResult("Do bloeh", ["tag-b"], "certain"), "summary")) self.assertEqual("possible", result.minimum_success_certainty())
def test_default_certainty(self): self.assertEqual( FixerResult("Do bla", ["tag-a"], None), parse_script_fixer_output("""\ Do bla Fixed-Lintian-Tags: tag-a """), )
def test_simple(self): self.assertEqual( FixerResult("Do bla", ["tag-a"], "certain"), parse_script_fixer_output("""\ Do bla Fixed-Lintian-Tags: tag-a Certainty: certain """), )
def test_patch_name(self): self.assertEqual( FixerResult("Do bla", ["tag-a"], "certain", "aname"), parse_script_fixer_output("""\ Do bla Fixed-Lintian-Tags: tag-a Certainty: certain Patch-Name: aname """), )
def test_simple_modify(self): with self.tree.lock_write(): result = run_lintian_fixers(self.tree, [DummyFixer("dummy", "some-tag")], update_changelog=False) revid = self.tree.last_revision() self.assertEqual( [( FixerResult( "Fixed some tag.\nExtended description.", ["some-tag"], "certain", revision_id=revid, ), "Fixed some tag.", )], result.success, ) self.assertEqual({}, result.failed_fixers) self.assertEqual(2, self.tree.branch.revno()) self.assertEqual( self.tree.get_file_lines("debian/control")[-1], b"a new line\n")
def run(self, basedir, package, *args, **kwargs): with open(os.path.join(basedir, "configure.ac"), "w") as f: f.write("AC_INIT(foo, bar)\n") return FixerResult("Created new configure.ac.", [], patch_name="add-config")
def run(self, basedir, package, *args, **kwargs): return FixerResult("I didn't actually change anything.")
def run(self, basedir, package, *args, **kwargs): os.rename( os.path.join(basedir, "debian/control"), os.path.join(basedir, "debian/control.blah"), ) return FixerResult("Renamed a file.")
def run(self, basedir, package, *args, **kwargs): with open(os.path.join(basedir, "debian/somefile"), "w") as f: f.write("test") return FixerResult("Created new file.", ["some-tag"])
def run(self, basedir, package, *args, **kwargs): with open(os.path.join(basedir, "debian/somefile"), "w") as f: f.write("test") return FixerResult("Renamed a file.", certainty="possible")
def run(self, basedir, package, *args, **kwargs): with open(os.path.join(basedir, "debian/control"), "a") as f: f.write("a new line\n") return FixerResult("Fixed some tag.\nExtended description.", ["some-tag"], "certain")
def test_no_certainty(self): result = ManyResult() result.success.append((FixerResult("Do bla", ["tag-a"], None), "summary")) self.assertEqual("certain", result.minimum_success_certainty())