Exemple #1
0
 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())
Exemple #2
0
    def test_default_certainty(self):
        self.assertEqual(
            FixerResult("Do bla", ["tag-a"], None),
            parse_script_fixer_output("""\
Do bla
Fixed-Lintian-Tags: tag-a
"""),
        )
Exemple #3
0
    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
"""),
        )
Exemple #4
0
    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
"""),
        )
Exemple #5
0
 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")
Exemple #6
0
 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")
Exemple #7
0
 def run(self, basedir, package, *args, **kwargs):
     return FixerResult("I didn't actually change anything.")
Exemple #8
0
 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.")
Exemple #9
0
 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"])
Exemple #10
0
 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")
Exemple #11
0
 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")
Exemple #12
0
 def test_no_certainty(self):
     result = ManyResult()
     result.success.append((FixerResult("Do bla", ["tag-a"],
                                        None), "summary"))
     self.assertEqual("certain", result.minimum_success_certainty())