def test_other_branch(self): "Run the HgClone command for another branch." 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'] == '949a4d660f2e 2 default' assert results_info['version_type'] == 'hg' # check files cwd = os.getcwd() os.chdir(self.context.tempdir) try: 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.py')) finally: os.chdir(cwd)
def setup(self): # create a context within which to run the SvnCheckout command self.context = TempDirectoryContext() self.context.initialize() (cache_parent, cache_dir) = create_cache_location(self.repository_url) self.cache_parent = cache_parent cwd = os.getcwd() # save current directory # # next, we want to set up the cached repository so that it contains an # old checkout. # os.chdir(cache_dir) # now, check out the test svn repository. (ret, out, err) = _run_command(['svn', 'checkout', self.repository_url, 'pony-build-svn-test']) assert ret == 0, (out, err) # forcibly check out the first revision, instead of the second. (ret, out, err) = _run_command(['svn', 'update', '-r2'], cwd='pony-build-svn-test') assert ret == 0, (out, err) assert os.path.exists(os.path.join('pony-build-svn-test', 'test1')) assert not os.path.exists(os.path.join('pony-build-svn-test', 'test2')) os.chdir(cwd) # return to working dir.
def setup(self): # create a context within which to run the HgClone command self.context = TempDirectoryContext() self.context.initialize() (cache_parent, cache_dir) = create_cache_location(self.repository_url) self.cache_parent = cache_parent cwd = os.getcwd() # save current directory # # next, we want to set up the cached repository so that it contains an # old checkout. # os.chdir(cache_dir) # now, check out the test hg repository. (ret, out, err) = _run_command(['hg', 'clone', self.repository_url]) assert ret == 0, (out, err) # 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 os.path.exists(os.path.join('pony-build-hg-test', 'test4.py')) os.chdir(cwd) # return to working dir.
#! /usr/bin/env python import sys from pony_client import HgClone, Context, TempDirectoryContext, _run_command context = Context() url = 'http://bitbucket.org/ned/coveragepy/' (ret, out, err) = _run_command(['hg', 'clone', url]) assert ret == 0, (out, err) commands = [ HgClone(url) ] print 'Success'