Skip to content

Commit

Permalink
simple darcs test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Jun 12, 2010
1 parent e009708 commit 4026d33
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion slave/buildslave/commands/darcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def parseGotRevision(self):
command = [self.vcexe, "changes", "--context"]
c = runprocess.RunProcess(self.builder, command,
os.path.join(self.builder.basedir, self.srcdir),
environ=self.env,
environ=self.env, timeout=self.timeout,
sendStdout=False, sendStderr=False, sendRC=False,
keepStdout=True, usePTY=False)
d = c.start()
Expand Down
56 changes: 56 additions & 0 deletions slave/buildslave/test/unit/test_commands_darcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import os

from twisted.trial import unittest
from twisted.python import runtime

from buildslave.test.fake.runprocess import Expect
from buildslave.test.util.sourcecommand import SourceCommandTestMixin
from buildslave.commands import darcs

class TestDarcs(SourceCommandTestMixin, unittest.TestCase):

def setUp(self):
self.setUpCommand()

def tearDown(self):
self.tearDownCommand()

def test_simple(self):
self.patch_getCommand('darcs', 'path/to/darcs')
self.clean_environ()
self.make_command(darcs.Darcs, dict(
workdir='workdir',
mode='copy',
revision=None,
repourl='http://darcs.net',
))

exp_environ = dict(PWD='.', LC_MESSAGES='C')
expects = [
Expect([ 'clobber', 'workdir' ],
self.basedir)
+ 0,
Expect([ 'clobber', 'source' ],
self.basedir)
+ 0,
Expect([ 'path/to/darcs', 'get', '--verbose', '--partial', '--repo-name',
'source', 'http://darcs.net'],
self.basedir,
sendRC=False, timeout=120, usePTY=False)
+ 0,
Expect([ 'path/to/darcs', 'changes', '--context' ],
os.path.join(self.basedir, 'source'),
sendRC=False, timeout=120, usePTY=False, keepStdout=True,
environ=exp_environ, sendStderr=False, sendStdout=False)
+ { 'stdout' : '9753\n' }
+ 0,
Expect([ 'copy', 'source', 'workdir'],
self.basedir)
+ 0,
]
self.patch_runprocess(*expects)

d = self.run_command()
d.addCallback(self.check_sourcedata, "http://darcs.net\n")
return d

0 comments on commit 4026d33

Please sign in to comment.