예제 #1
0
    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.
예제 #2
0
    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.
예제 #3
0
class Test_SvnCachingUpdate(object):
    repository_url = 'http://pony-build.googlecode.com/svn/pony-build-svn-test'

    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 teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']

        shutil.rmtree(self.cache_parent, ignore_errors=True)

    def test_basic(self):
        "Run the SvnCheckout command and verify that it updates right."
        command = SvnCheckout('pony-build-svn-test', self.repository_url)
        command.verbose = True
        command.run(self.context)

        pprint.pprint(command.get_results()) # debugging output

        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-svn-test', 'test1'))
            assert os.path.exists(os.path.join('pony-build-svn-test', 'test2'))
        finally:
            os.chdir(cwd)
        

        
                   
예제 #4
0
class Test_SvnCachingCheckout(object):
    repository_url = 'http://pony-build.googlecode.com/svn/pony-build-svn-test'

    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

    def teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']

        shutil.rmtree(self.cache_parent, ignore_errors=True)

    def test_basic(self):
        "Run the SvnCheckout command and verify that it works."
        command = SvnCheckout('pony-build-svn-test', self.repository_url)
        command.verbose = True
        command.run(self.context)

        pprint.pprint(command.get_results()) # debugging output

        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-svn-test', 'test1'))
            assert os.path.exists(os.path.join('pony-build-svn-test', 'test2'))
        finally:
            os.chdir(cwd)
예제 #5
0
    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
예제 #6
0
class Test_SvnCachingUpdate(object):
    repository_url = 'http://pony-build.googlecode.com/svn/pony-build-svn-test'

    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 teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']

        shutil.rmtree(self.cache_parent, ignore_errors=True)

    def test_basic(self):
        "Run the SvnCheckout command and verify that it updates right."
        command = SvnCheckout('pony-build-svn-test', self.repository_url)
        command.verbose = True
        command.run(self.context)

        pprint.pprint(command.get_results()) # debugging output

        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-svn-test', 'test1'))
            assert os.path.exists(os.path.join('pony-build-svn-test', 'test2'))
        finally:
            os.chdir(cwd)
예제 #7
0
class Test_MercurialCachingCheckout(object):
    repository_url = 'http://bitbucket.org/cherkf/pony-build-hg-test/'
 
    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
 
    def teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']
 
        shutil.rmtree(self.cache_parent)
 
    def test_basic(self):
        "Run the HgClone command and verify that it produces the right repo."
        command = HgClone(self.repository_url)
        command.verbose = True
        command.run(self.context)
 
        pprint.pprint(command.get_results()) # debugging output
 
        os.chdir(self.context.tempdir)
        assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
        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('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'] == '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  os.path.exists(os.path.join('pony-build-hg-test',
                                                   'test2'))
          #  assert os.path.exists(os.path.join('pony-build-hg-test', 'test4'))
        finally:
            os.chdir(cwd)
예제 #8
0
class Test_GitNonCachingCheckout(object):
    repository_url = 'http://github.com/ctb/pony-build-git-test.git'

    def setup(self):
        # create a context within which to run the GitClone command
        self.context = TempDirectoryContext()
        self.context.initialize()

    def teardown(self):
        self.context.finish()

    def test_basic(self):
        "Run the GitClone command w/o caching and verify it."
        command = GitClone(self.repository_url, use_cache=False)
        command.run(self.context)

        # check version info
        results_info = command.get_results()
        pprint.pprint(results_info) # debugging output

        assert results_info['version_info'] == """\
c57591d8cc9ef3c293a2006416a0bb8b2ffed26d secondary commit"""
        assert results_info['version_type'] == 'git'

        # check files
        os.chdir(self.context.tempdir)
        assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
        assert os.path.exists(os.path.join('pony-build-git-test', 'test2'))
        
    def test_other_branch(self):
        "Run the GitClone command for another branch."
        
        command = GitClone(self.repository_url, branch='other',
                           use_cache=False)
        command.run(self.context)

        # check version info
        results_info = command.get_results()
        pprint.pprint(results_info) # debugging output

        assert results_info['version_info'] == """\
7f8a8e130a3cc631752e275ea57220a1b6e2dddb look ma, another branch\\!"""
        assert results_info['version_type'] == 'git'

        # check files
        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
            assert not os.path.exists(os.path.join('pony-build-git-test',
                                                   'test2'))
            assert os.path.exists(os.path.join('pony-build-git-test', 'test3'))
        finally:
            os.chdir(cwd)
예제 #9
0
def test_misc_TempDirectoryContext_things():

    c = TempDirectoryContext()

    c.initialize()
    # test for temp folder creation
    assert os.path.exists(c.tempdir)

    c.finish()
    # test for temp folder proper deletion
    assert not os.path.exists(c.tempdir)
예제 #10
0
class Test_MercurialNonCachingCheckout(object):
    repository_url = 'http://bitbucket.org/cherkf/pony-build-hg-test/'
 
    def setup(self):
        # create a context within which to run the HgClone command
        self.context = TempDirectoryContext()
        self.context.initialize()
 
    def teardown(self):
        self.context.finish()
 
    def test_basic(self):
        "Run the HgClone command w/o caching and verify it."
        command = HgClone(self.repository_url, use_cache=False)
        command.verbose = True
        command.run(self.context)
 
        pprint.pprint(command.get_results()) # debugging output
 
        os.chdir(self.context.tempdir)
        assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
        assert os.path.exists(os.path.join('pony-build-hg-test', 'test2'))
예제 #11
0
class Test_SvnNonCachingCheckout(object):
    repository_url = 'http://pony-build.googlecode.com/svn/pony-build-svn-test'

    def setup(self):
        # create a context within which to run the SvnCheckout command
        self.context = TempDirectoryContext()
        self.context.initialize()

    def teardown(self):
        self.context.finish()

    def test_basic(self):
        "Run the SvnCheckout command w/o caching and verify it."
        command = SvnCheckout('pony-build-svn-test', self.repository_url,
                              use_cache=False)
        command.verbose = True
        command.run(self.context)

        pprint.pprint(command.get_results()) # debugging output

        os.chdir(self.context.tempdir)
        assert os.path.exists(os.path.join('pony-build-svn-test', 'test1'))
        assert os.path.exists(os.path.join('pony-build-svn-test', 'test2'))
예제 #12
0
def test_misc_TempDirectoryContext_things():

    c = TempDirectoryContext()

    c.initialize()
    # test for temp folder creation
    assert os.path.exists(c.tempdir)

    c.finish()
    # test for temp folder proper deletion
    assert not os.path.exists(c.tempdir)
예제 #13
0
class Test_GitCachingCheckout(object):
    repository_url = 'http://github.com/ctb/pony-build-git-test.git'

    def setup(self):
        # create a context within which to run the GitClone command
        self.context = TempDirectoryContext()
        self.context.initialize()

        (cache_parent, cache_dir) = create_cache_location(self.repository_url)
        self.cache_parent = cache_parent

    def teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']

        shutil.rmtree(self.cache_parent, ignore_errors=True)

    def test_basic(self):
        "Run the GitClone command and verify that it produces the right repo."
        command = GitClone(self.repository_url)
        command.run(self.context)

        results_info = command.get_results()
        pprint.pprint(results_info) # debugging output

        assert results_info['version_info'] == """\
c57591d8cc9ef3c293a2006416a0bb8b2ffed26d secondary commit"""
        assert results_info['version_type'] == 'git'

        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
            assert os.path.exists(os.path.join('pony-build-git-test', 'test2'))
        finally:
            os.chdir(cwd)

    def test_other_branch(self):
        "Run the GitClone command for another branch."
        
        command = GitClone(self.repository_url, branch='other')
        command.run(self.context)

        # check version info
        results_info = command.get_results()
        pprint.pprint(results_info) # debugging output

        assert results_info['version_info'] == """\
7f8a8e130a3cc631752e275ea57220a1b6e2dddb look ma, another branch\\!"""
        assert results_info['version_type'] == 'git'

        # check files
        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
            assert not os.path.exists(os.path.join('pony-build-git-test',
                                                   'test2'))
            assert os.path.exists(os.path.join('pony-build-git-test', 'test3'))
        finally:
            os.chdir(cwd)
예제 #14
0
class Test_GitCachingUpdate(object):
    repository_url = 'http://github.com/ctb/pony-build-git-test.git'

    def setup(self):
        # create a context within which to run the GitClone 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 git repository.
        (ret, out, err) = _run_command(['git', 'clone', self.repository_url])
        assert ret == 0, (out, err)

        # forcibly check out the first revision, instead of the second.
        (ret, out, err) = _run_command(['git', 'checkout', '0a59ded1fc'],
                                       cwd='pony-build-git-test')
        assert ret == 0, (out, err)
        assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
        assert not os.path.exists(os.path.join('pony-build-git-test', 'test2'))

        os.chdir(cwd)                           # return to working dir.
        
    def teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']

        shutil.rmtree(self.cache_parent, ignore_errors=True)

    def test_basic(self):
        "Run the GitClone command and verify that it produces an updated repo."
        command = GitClone(self.repository_url)
        command.run(self.context)

        results_info = command.get_results()
        pprint.pprint(results_info) # debugging output

        assert results_info['version_info'] == """\
c57591d8cc9ef3c293a2006416a0bb8b2ffed26d secondary commit"""
        assert results_info['version_type'] == 'git'

        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
            assert os.path.exists(os.path.join('pony-build-git-test', 'test2'))
        finally:
            os.chdir(cwd)
        
    def test_other_branch(self):
        "Run the GitClone command for another branch."
        
        command = GitClone(self.repository_url, branch='other')
        command.run(self.context)

        # check version info
        results_info = command.get_results()
        pprint.pprint(results_info) # debugging output

        assert results_info['version_info'] == """\
7f8a8e130a3cc631752e275ea57220a1b6e2dddb look ma, another branch\\!"""
        assert results_info['version_type'] == 'git'

        # check files
        cwd = os.getcwd()
        os.chdir(self.context.tempdir)
        try:
            assert os.path.exists(os.path.join('pony-build-git-test', 'test1'))
            assert not os.path.exists(os.path.join('pony-build-git-test',
                                                   'test2'))
            assert os.path.exists(os.path.join('pony-build-git-test', 'test3'))
        finally:
            os.chdir(cwd)
예제 #15
0
 def setup(self):
     # create a context within which to run the SvnCheckout command
     self.context = TempDirectoryContext()
     self.context.initialize()
예제 #16
0
 def setup(self):
     # create a context within which to run the GitClone command
     self.context = TempDirectoryContext()
     self.context.initialize()
예제 #17
0
class Test_MercurialCachingUpdate(object):
    repository_url = 'http://bitbucket.org/cherkf/pony-build-hg-test/'
 
    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.
        
    def teardown(self):
        self.context.finish()
        del os.environ['PONY_BUILD_CACHE']
 
        shutil.rmtree(self.cache_parent)
 
    def test_basic(self):
        "Run the HgClone command and verify that it produces an updated repo."
        command = HgClone(self.repository_url)
        command.verbose = True
        command.run(self.context)
 
        pprint.pprint(command.get_results()) # debugging output
 
        os.chdir(self.context.tempdir)
        assert os.path.exists(os.path.join('pony-build-hg-test', 'test1'))
        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)
        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)
예제 #18
0
name = 'mechanize'
tags = ['mechanize']
server_url = options.server_url

if not options.force_build:
    if not check(name, server_url, tags=tags):
        print 'check build says no need to build; bye'
        sys.exit(0)

commands = [
    SvnCheckout('mechanize', repo_url, name='checkout'),
    BuildCommand([python_exe, 'setup.py', 'test'])
]

context = TempDirectoryContext()
results = do(name, commands, context=context)
client_info, reslist, files = results

if options.report:
    print 'result: %s; sending' % (client_info['success'], )
    send(server_url, results, tags=tags)
else:
    print 'build result:'
    pprint.pprint(client_info)
    pprint.pprint(reslist)

    print '(NOT SENDING BUILD RESULT TO SERVER)'

if not client_info['success']:
    sys.exit(-1)