Пример #1
0
def pep8(dsc, analysis):
    run_command(["dpkg-source", "-x", dsc, "source"])
    with cd('source'):
        out, err, ret = run_command(['pep8', '.'])
        failed = ret != 0

        for issue in parse_pep8(out.splitlines()):
            analysis.results.append(issue)

        return (analysis, out, failed, None)
Пример #2
0
def pep8(dsc, analysis):
    run_command(["dpkg-source", "-x", dsc, "source-pep8"])
    with cd('source-pep8'):
        out, err, ret = run_command(['pep8', '.'])
        failed = ret != 0

        for issue in parse_pep8(out.splitlines()):
            analysis.results.append(issue)

        return (analysis, out, failed, None, None)
Пример #3
0
def test_pep8_wrappers():
    pep8_analysis = test_pep8_common()
    issues = parse_pep8(pep8_analysis[1].splitlines())
    i = 0
    for issue in issues:
        if issue.location.file.givenpath == "./firehose/model.py" and \
           issue.location.point.line==96 and issue.location.point.column==1:
            found = issue
        i += 1
    print found
    assert found.testid == "E302"
    assert found.location.file.givenpath == "./firehose/model.py"
    assert found.location.point.line == 96
    assert found.location.point.column == 1
    assert found.severity == "error"
    assert found.notes is None
    assert found.customfields is None
    assert "E302 expected 2 blank lines, found 1" in found.message.text
    assert i > 100
Пример #4
0
 def test_pep8_wrappers(self):
     pep8_analysis = pep8(self.filepath, self.firehose_results)
     issues = parse_pep8(pep8_analysis[1].splitlines())
     i = 0
     for issue in issues:
         if issue.location.file.givenpath == "./firehose/model.py" and \
         issue.location.point.line==96 and issue.location.point.column==1:
             found = issue
         i += 1
     print found
     self.assertEquals(found.testid, "E302")
     self.assertEquals(found.location.file.givenpath, "./firehose/model.py")
     self.assertEquals(found.location.point.line, 96)
     self.assertEquals(found.location.point.column, 1)
     self.assertEquals(found.severity, "error")
     self.assertIsNone(found.notes)
     self.assertIsNone(found.customfields)
     self.assertTrue("E302 expected 2 blank lines, found 1" in found.message.text)
     self.assertTrue(i > 100)