Permalink
Browse files

real hg test branch

  • Loading branch information...
1 parent 3907867 commit 03174e8494f7d889a986dbc716b5766aab7632c5 @cherkf cherkf committed Apr 12, 2010
Showing with 24 additions and 54 deletions.
  1. +0 −38 client/test-git
  2. +24 −16 client/test_client/test_hg_client.py
View
@@ -1,38 +0,0 @@
-#! /usr/bin/env python
-import sys, os
-import tempfile
-
-import pony_client
-
-# set up a temp directory to test the cache dir stuff
-cache_loc = tempfile.mkdtemp()
-print 'using temp dir for cache:', cache_loc
-
-os.environ['PONY_BUILD_CACHE'] = cache_loc
-
-# set up another temp dir to do the checkout
-testdir = tempfile.mkdtemp()
-print 'using temp dir for testing:', testdir
-
-os.chdir(testdir)
-
-context = pony_client.Context()
-clone = pony_client.GitClone('git://github.com/ctb/pony-build.git')
-
-context.initialize()
-context.start_command(clone)
-clone.run(context)
-context.end_command(clone)
-
-print 'success or failure?', clone.success()
-
-# we should see that in the putative cache dir, pony-build/README.txt exists.
-testfile = os.path.join(cache_loc, 'pony-build', 'README.txt')
-print '** cache dir created?', os.path.exists(testfile)
-print testfile, 'exists'
-
-# we should also see that in the final checkout dir, pony-build/README.txt is
-# there.
-testfile = os.path.join(testdir, 'pony-build', 'README.txt')
-print '** final checkout success?', os.path.exists(testfile)
-print testfile, 'exists'
@@ -93,26 +93,28 @@ def test_basic(self):
assert os.path.exists(os.path.join('pony-build-hg-test', 'test2'))
def test_other_branch(self):
"Run the HgClone command for another branch."
-
- command = HgClone(self.repository_url, '-r', 7 )
+
+ command = HgClone('http://bitbucket.org/cherkf/pony-build-hg-test/')
command.run(self.context)
+ #commands.getoutput('hg', 'update', 'extrabranch')
+
+ #pprint.pprint(cmdlist.get_results()) #debugging output
# check version info
results_info = command.get_results()
pprint.pprint(results_info) # debugging output
- assert results_info['version_info'] == """
-1d4537588c4c\ look ma, another branch\\!"""
+ assert results_info['version_info'] == '949a4d660f2e 2 default'
assert results_info['version_type'] == 'hg'
# check files
cwd = os.getcwd()
os.chdir(self.context.tempdir)
try:
assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
- assert not os.path.exists(os.path.join('pony-build-hg-test',
+ assert os.path.exists(os.path.join('pony-build-hg-test',
'test2'))
- assert os.path.exists(os.path.join('pony-build-hg-test', 'test4'))
+ # assert os.path.exists(os.path.join('pony-build-hg-test', 'test4'))
finally:
os.chdir(cwd)
@@ -141,12 +143,12 @@ def setup(self):
(ret, out, err) = _run_command(['hg', 'clone', self.repository_url])
assert ret == 0, (out, err)
- # forcibly check out revision 0 instead of revision 1.
- (ret, out, err) = _run_command(['hg', 'checkout', '0'],
+ # forcibly check out revision 7 instead of revision 1.
+ (ret, out, err) = _run_command(['hg', 'checkout', '7'],
cwd='pony-build-hg-test')
assert ret == 0, (out, err)
assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
- assert not os.path.exists(os.path.join('pony-build-hg-test', 'test2'))
+ assert os.path.exists(os.path.join('pony-build-hg-test', 'test4.py'))
os.chdir(cwd) # return to working dir.
@@ -170,25 +172,31 @@ def test_basic(self):
def test_other_branch(self):
"Run the HgClone command for another branch."
- command = HgClone(self.repository_url, '-r', 7)
+ command = HgClone(self.repository_url)
command.run(self.context)
-
+ # forcibly check out revision 7 instead of revision 1.
+ (ret, out, err) = _run_command(['hg', 'checkout', '7'],
+ cwd='pony-build-hg-test')
+ (ret, out, err) = _run_command(['hg', 'identify'],
+ cwd='pony-build-hg-test')
+
+ #os.chdir(cwd) # return to working dir.
# check version info
results_info = command.get_results()
pprint.pprint(results_info) # debugging output
- assert results_info['version_info'] == """\
-1d4537588c4c look ma, another branch\\!"""
+ assert results_info['version_info'] == '949a4d660f2e 2 default'
assert results_info['version_type'] == 'hg'
# check files
cwd = os.getcwd()
os.chdir(self.context.tempdir)
try:
- assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
- assert not os.path.exists(os.path.join('pony-build-hg-test',
+ assert ret == 0, (out, err)
+ assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
+ assert os.path.exists(os.path.join('pony-build-hg-test',
'test2'))
- assert os.path.exists(os.path.join('pony-build-hg-test', 'test4'))
+ assert os.path.exists(os.path.join('pony-build-hg-test', 'test4.py'))
finally:
os.chdir(cwd)

0 comments on commit 03174e8

Please sign in to comment.