Ejemplo n.º 1
0
 def test_success(self):
     self.setup_step(python.PyFlakes())
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'])
         .exit(0))
     self.expect_outcome(result=SUCCESS, state_string='pyflakes')
     return self.run_step()
Ejemplo n.º 2
0
 def test_success(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir',
                     command=['make', 'pyflakes'],
                     usePTY='slave-config') + 0)
     self.expectOutcome(result=SUCCESS, status_text=['pyflakes'])
     return self.runStep()
Ejemplo n.º 3
0
 def test_content_in_header(self):
     self.setup_step(python.PyFlakes())
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'])
         # don't match pyflakes-like output in the header
         .log('stdio', header="foo.py:1: 'bar' imported but unused\n")
         .exit(0))
     self.expect_outcome(result=0, state_string='pyflakes')
     return self.run_step()
Ejemplo n.º 4
0
 def test_misc(self):
     self.setup_step(python.PyFlakes())
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'])
         .stdout("foo.py:2: redefinition of function 'bar' from line 1\n")
         .exit(1))
     self.expect_outcome(result=WARNINGS,
                        state_string='pyflakes misc=1 (warnings)')
     self.expect_property('pyflakes-misc', 1)
     self.expect_property('pyflakes-total', 1)
     return self.run_step()
Ejemplo n.º 5
0
 def test_importstar(self):
     self.setup_step(python.PyFlakes())
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'])
         .stdout("foo.py:1: 'from module import *' used; unable to detect undefined names\n")
         .exit(1))
     self.expect_outcome(result=WARNINGS,
                        state_string='pyflakes import*=1 (warnings)')
     self.expect_property('pyflakes-import*', 1)
     self.expect_property('pyflakes-total', 1)
     return self.run_step()
Ejemplo n.º 6
0
 def test_undefined(self):
     self.setup_step(python.PyFlakes())
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'])
         .stdout("foo.py:1: undefined name 'bar'\n")
         .exit(1))
     self.expect_outcome(result=FAILURE,
                        state_string='pyflakes undefined=1 (failure)')
     self.expect_property('pyflakes-undefined', 1)
     self.expect_property('pyflakes-total', 1)
     return self.run_step()
Ejemplo n.º 7
0
 def test_unused(self):
     self.setup_step(python.PyFlakes())
     self.expect_commands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'])
         .stdout("foo.py:1: 'bar' imported but unused\n")
         .exit(1))
     self.expect_outcome(result=WARNINGS,
                        state_string='pyflakes unused=1 (warnings)')
     self.expect_property('pyflakes-unused', 1)
     self.expect_property('pyflakes-total', 1)
     return self.run_step()
Ejemplo n.º 8
0
 def test_undefined(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes']) +
         ExpectShell.log('stdio',
                         stdout="foo.py:1: undefined name 'bar'\n") + 1)
     self.expectOutcome(result=FAILURE,
                        state_string='pyflakes undefined=1 (failure)')
     self.expectProperty('pyflakes-undefined', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 9
0
 def test_unused(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes']) +
         ExpectShell.log(
             'stdio', stdout="foo.py:1: 'bar' imported but unused\n") + 1)
     self.expectOutcome(result=WARNINGS,
                        state_string='pyflakes unused=1 (warnings)')
     self.expectProperty('pyflakes-unused', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 10
0
 def test_content_in_header(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'],
                     usePTY='slave-config')
         + ExpectShell.log(
             'stdio',
             # don't match pyflakes-like output in the header
             header="foo.py:1: 'bar' imported but unused\n")
         + 0)
     self.expectOutcome(result=0, state_string='pyflakes')
     return self.runStep()
Ejemplo n.º 11
0
 def test_undefined(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir',
                     command=['make', 'pyflakes'],
                     usePTY='slave-config') +
         ExpectShell.log('stdio',
                         stdout="foo.py:1: undefined name 'bar'\n") + 1)
     self.expectOutcome(result=FAILURE,
                        status_text=['pyflakes', 'undefined=1', 'failed'])
     self.expectProperty('pyflakes-undefined', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 12
0
 def test_unused(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir',
                     command=['make', 'pyflakes'],
                     usePTY='slave-config') +
         ExpectShell.log(
             'stdio', stdout="foo.py:1: 'bar' imported but unused\n") + 1)
     self.expectOutcome(result=WARNINGS,
                        status_text=['pyflakes', 'unused=1', 'warnings'])
     self.expectProperty('pyflakes-unused', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 13
0
 def test_misc(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes']) +
         ExpectShell.log(
             'stdio',
             stdout="foo.py:2: redefinition of function 'bar' from line 1\n"
         ) + 1)
     self.expectOutcome(result=WARNINGS,
                        state_string='pyflakes misc=1 (warnings)')
     self.expectProperty('pyflakes-misc', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 14
0
 def test_importstar(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'],
                     usePTY='slave-config')
         + ExpectShell.log(
             'stdio',
             stdout="foo.py:1: 'from module import *' used; unable to detect undefined names\n")
         + 1)
     self.expectOutcome(result=WARNINGS,
                        state_string='pyflakes import*=1 (warnings)')
     self.expectProperty('pyflakes-import*', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 15
0
 def test_redefs(self):
     self.setupStep(python.PyFlakes())
     self.expectCommands(
         ExpectShell(workdir='wkdir', command=['make', 'pyflakes'],
                     usePTY='slave-config')
         + ExpectShell.log(
             'stdio',
             stdout="foo.py:2: redefinition of unused 'foo' from line 1\n")
         + 1)
     self.expectOutcome(result=WARNINGS,
                        state_string='pyflakes redefs=1 (warnings)')
     self.expectProperty('pyflakes-redefs', 1)
     self.expectProperty('pyflakes-total', 1)
     return self.runStep()
Ejemplo n.º 16
0
 def testAllSteps(self):
     # make sure that steps can be created from the factories that they
     # return
     for s in (
             dummy.Dummy(),
             dummy.FailingDummy(),
             dummy.RemoteDummy(),
             maxq.MaxQ("testdir"),
             python.BuildEPYDoc(),
             python.PyFlakes(),
             python_twisted.HLint(),
             python_twisted.Trial(testpath=None, tests="tests"),
             python_twisted.ProcessDocs(),
             python_twisted.BuildDebs(),
             python_twisted.RemovePYCs(),
             shell.ShellCommand(),
             shell.TreeSize(),
             shell.Configure(),
             shell.Compile(),
             shell.Test(),
             source.CVS("cvsroot", "module"),
             source.SVN("svnurl"),
             source.Darcs("repourl"),
             source.Git("repourl"),
             source.Arch("url", "version"),
             source.Bazaar("url", "version", "archive"),
             source.Bzr("repourl"),
             source.Mercurial("repourl"),
             source.P4("p4base"),
             source.P4Sync(1234, "p4user", "passwd", "client", mode="copy"),
             source.Monotone("server", "branch"),
             transfer.FileUpload("src", "dest"),
             transfer.FileDownload("src", "dest"),
     ):
         try:
             self._loop(s)
         except:
             print "error checking %s" % s
             raise