def test_run_jobsProperties(self): """ C{jobs} should accept Properties """ self.setup_step( python_twisted.Trial(workdir='build', tests='testname', jobs=Property('jobs_count'), testpath=None)) self.properties.setProperty('jobs_count', '2', 'Test') self.expect_commands( ExpectShell(workdir='build', command=[ 'trial', '--reporter=bwverbose', '--jobs=2', 'testname' ], logfiles={ 'test.0.log': '_trial_temp/0/test.log', 'err.0.log': '_trial_temp/0/err.log', 'out.0.log': '_trial_temp/0/out.log', 'test.1.log': '_trial_temp/1/test.log', 'err.1.log': '_trial_temp/1/err.log', 'out.1.log': '_trial_temp/1/out.log', }).stdout("Ran 1 tests\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string='1 test passed') return self.run_step()
def test_run_jobs(self): """ The C{jobs} kwarg should correspond to trial's -j option ( included since Twisted 12.3.0), and make corresponding changes to logfiles. """ self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath=None, jobs=2)) self.expectCommands( ExpectShell( workdir='build', command=[ 'trial', '--reporter=bwverbose', '--jobs=2', 'testname' ], usePTY="slave-config", logfiles={ 'test.0.log': '_trial_temp/0/test.log', 'err.0.log': '_trial_temp/0/err.log', 'out.0.log': '_trial_temp/0/out.log', 'test.1.log': '_trial_temp/1/test.log', 'err.1.log': '_trial_temp/1/err.log', 'out.1.log': '_trial_temp/1/out.log', }) + ExpectShell.log('stdio', stdout="Ran 1 tests\n") + 0) self.expectOutcome(result=SUCCESS, status_text=['1 test', 'passed']) return self.runStep()
def test_run_jobsProperties(self): """ C{jobs} should accept Properties """ self.setupStep( python_twisted.Trial(workdir='build', tests='testname', jobs=Property('jobs_count'), testpath=None)) self.properties.setProperty('jobs_count', '2', 'Test') self.expectCommands( ExpectShell( workdir='build', command=[ 'trial', '--reporter=bwverbose', '--jobs=2', 'testname' ], usePTY="slave-config", logfiles={ 'test.0.log': '_trial_temp/0/test.log', 'err.0.log': '_trial_temp/0/err.log', 'out.0.log': '_trial_temp/0/out.log', 'test.1.log': '_trial_temp/1/test.log', 'err.1.log': '_trial_temp/1/err.log', 'out.1.log': '_trial_temp/1/out.log', }) + ExpectShell.log('stdio', stdout="Ran 1 tests\n") + 0) self.expectOutcome(result=SUCCESS, status_text=['1 test', 'passed']) return self.runStep()
def test_run_jobs(self): """ The C{jobs} kwarg should correspond to trial's -j option ( included since Twisted 12.3.0), and make corresponding changes to logfiles. """ self.setup_step( python_twisted.Trial(workdir='build', tests='testname', testpath=None, jobs=2)) self.expect_commands( ExpectShell(workdir='build', command=[ 'trial', '--reporter=bwverbose', '--jobs=2', 'testname' ], logfiles={ 'test.0.log': '_trial_temp/0/test.log', 'err.0.log': '_trial_temp/0/err.log', 'out.0.log': '_trial_temp/0/out.log', 'test.1.log': '_trial_temp/1/test.log', 'err.1.log': '_trial_temp/1/err.log', 'out.1.log': '_trial_temp/1/out.log', }).stdout("Ran 1 tests\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string='1 test passed') return self.run_step()
def test_run_plural(self): self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath=None)) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}) + ExpectShell.log('stdio', stdout="Ran 2 tests\n") + 0) self.expectOutcome(result=SUCCESS, state_string='2 tests passed') return self.runStep()
def test_run_singular(self): self.setup_step( python_twisted.Trial(workdir='build', tests='testname', testpath=None)) self.expect_commands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={ 'test.log': '_trial_temp/test.log' }).stdout("Ran 1 tests\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string='1 test passed') return self.run_step()
def test_run_singular(self): self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath=None)) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], usePTY="slave-config", logfiles={'test.log': '_trial_temp/test.log'}) + ExpectShell.log('stdio', stdout="Ran 1 tests\n") + 0) self.expectOutcome(result=SUCCESS, status_text=['1 test', 'passed']) return self.runStep()
def test_build_changed_files(self): self.setupStep(python_twisted.Trial(workdir='build', testChanges=True, testpath=None), buildFiles=['my/test/file.py', 'my/test/file2.py']) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', '--testmodule=my/test/file.py', '--testmodule=my/test/file2.py'], logfiles={'test.log': '_trial_temp/test.log'}) + ExpectShell.log('stdio', stdout="Ran 2 tests\n") + 0 ) self.expectOutcome(result=SUCCESS, state_string='2 tests passed') return self.runStep()
def test_run_env_nodupe(self): self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath='path2', env={'PYTHONPATH': ['path1', 'path2']})) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}, env=dict(PYTHONPATH=['path1', 'path2'])) + ExpectShell.log('stdio', stdout="Ran 0 tests\n") + 0) self.expectOutcome(result=SUCCESS, state_string='no tests run') return self.runStep()
def test_run_env_supplement(self): self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath='path1', env={'PYTHONPATH': ['path2', 'path3']})) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], usePTY="slave-config", logfiles={'test.log': '_trial_temp/test.log'}, env=dict(PYTHONPATH=['path1', 'path2', 'path3'])) + ExpectShell.log('stdio', stdout="Ran 0 tests\n") + 0) self.expectOutcome(result=SUCCESS, status_text=['no tests', 'run']) return self.runStep()
def test_test_path_env_python_path(self): self.setupStep(python_twisted.Trial(workdir='build', tests='testname', testpath='custom/test/path', env={'PYTHONPATH': '/existing/pypath'})) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}, env={'PYTHONPATH': ['custom/test/path', '/existing/pypath']}) + Expect.log('stdio', stdout="Ran 2 tests\n") + 0 ) self.expectOutcome(result=SUCCESS, state_string='2 tests passed') return self.runStep()
def testProperties(self): self.setupStep( python_twisted.Trial(workdir='build', tests=Property('test_list'), testpath=None)) self.properties.setProperty('test_list', ['testname'], 'Test') self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], usePTY="slave-config", logfiles={'test.log': '_trial_temp/test.log'}) + ExpectShell.log('stdio', stdout="Ran 2 tests\n") + 0) self.expectOutcome(result=SUCCESS, state_string='2 tests passed') return self.runStep()
def test_renderable_properties(self): self.setup_step( python_twisted.Trial(workdir='build', tests=Property('test_list'), testpath=None)) self.properties.setProperty('test_list', ['testname'], 'Test') self.expect_commands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={ 'test.log': '_trial_temp/test.log' }).stdout("Ran 2 tests\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string='2 tests passed') return self.run_step()
def test_run_env_supplement(self): self.setup_step( python_twisted.Trial(workdir='build', tests='testname', testpath='path1', env={'PYTHONPATH': ['path2', 'path3']})) self.expect_commands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}, env=dict(PYTHONPATH=['path1', 'path2', 'path3'])) .stdout("Ran 0 tests\n") .exit(0) ) self.expect_outcome(result=SUCCESS, state_string='no tests run') return self.run_step()
def test_run_failure(self): self.setupStep( python_twisted.Trial(workdir='build', tests='testname', testpath=None)) self.expectCommands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}) + ExpectShell.log('stdio', stdout=failureLog) + 1) self.expectOutcome(result=FAILURE, state_string='tests 8 failures (failure)') self.expectLogfile('problems', failureLog.split('\n\n', 1)[1][:-1]) self.expectLogfile('warnings', textwrap.dedent('''\ buildbot.test.unit.test_steps_python_twisted.Trial.test_run_env_nodupe ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_env_supplement ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_jobs ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_jobsProperties ... [FAILURE] ''')) # noqa: max-line-length return self.runStep()
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
def test_run_failure(self): self.setup_step( python_twisted.Trial(workdir='build', tests='testname', testpath=None)) self.expect_commands( ExpectShell(workdir='build', command=['trial', '--reporter=bwverbose', 'testname'], logfiles={'test.log': '_trial_temp/test.log'}) .stdout(failureLog) .exit(1) ) self.expect_outcome( result=FAILURE, state_string='tests 8 failures (failure)') self.expect_log_file('problems', failureLog.split('\n\n', 1)[1][:-1] + '\nprogram finished with exit code 1') self.expect_log_file('warnings', textwrap.dedent('''\ buildbot.test.unit.test_steps_python_twisted.Trial.test_run_env_nodupe ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_env_supplement ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_jobs ... [FAILURE]/home/dustin/code/buildbot/t/buildbot/master/buildbot/test/fake/logfile.py:92: UserWarning: step uses removed LogFile method `getText` buildbot.test.unit.test_steps_python_twisted.Trial.test_run_jobsProperties ... [FAILURE] ''')) # noqa pylint: disable=line-too-long return self.run_step()