Changeset 1265 in tailor for vcpx/tests/tailor.py


Ignore:
Timestamp:
08/25/06 00:46:37 (7 years ago)
Author:
lele@…
Hash name:
20060824224637-97f81-b1c3ff2bc67466cc3d7b6cdb68c0afa013e11783
Message:

New test for reappeared directory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/tests/tailor.py

    r1261 r1265  
    290290repository = file://%(testdir)s/cvsdirtest.svnrepo 
    291291 
     292[svnresurdirtest] 
     293target = svn:cvsresurdirtest 
     294start-revision = INITIAL 
     295root-directory = %(testdir)s/cvsresurdirtest/cvs2svn 
     296source = cvs:cvsresurdirtest 
     297subdir = test-work 
     298 
     299[cvs:cvsresurdirtest] 
     300module = test 
     301repository = %(testdir)s/cvsresurdirtest.cvsrepo 
     302 
     303[svn:cvsresurdirtest] 
     304module = test 
     305repository = file://%(testdir)s/cvsresurdirtest.svnrepo 
     306 
    292307''' 
    293308 
     
    609624        t = Tailorizer("svndirtest", self.config) 
    610625        t() 
     626 
     627 
     628class CvsReappearedDirectory(OperationalTest): 
     629    """Test problems with resurrected directories.""" 
     630 
     631    def setUp(self): 
     632        """Create a CVS repository that has the difficult history.""" 
     633 
     634        from os import mkdir, getcwd 
     635        from os.path import join, exists 
     636        from time import sleep 
     637        from shutil import rmtree 
     638 
     639        super(CvsReappearedDirectory, self).setUp() 
     640 
     641        repodir = join(self.TESTDIR, 'cvsresurdirtest.cvsrepo') 
     642        basedir = join(self.TESTDIR, 'cvsresurdirtest') 
     643 
     644        if not exists(repodir): 
     645            mkdir(basedir) 
     646            mkdir(repodir) 
     647            startdir = join(basedir, 'start') 
     648            mkdir(startdir) 
     649 
     650            cvs = ExternalCommand(cwd=startdir, nolog=True, command=['cvs', '-d', repodir]) 
     651            cvs.execute('init') 
     652 
     653            open(join(startdir, 'foo'), "w").close() 
     654 
     655            cvs.execute('import', '-m', 'one', 'test', 'test', 'test1') 
     656 
     657            workdir = join(basedir, 'work') 
     658            cvs.execute('checkout', '-d', workdir, 'test') 
     659 
     660            cvs = ExternalCommand(cwd=workdir, nolog=True, command=['cvs']) 
     661            bardir = join(workdir, 'bar') 
     662            mkdir(bardir) 
     663            baz = join(bardir, 'baz') 
     664            open(baz, "w").close() 
     665 
     666            cvs.execute('add', bardir, baz) 
     667            cvs.execute('commit', '-m', 'two', baz) 
     668            sleep(1) 
     669 
     670            cvs.execute('rm', '-f', baz) 
     671            cvs.execute('commit', '-m', 'three', baz) 
     672            cvs.execute('update', '-dP') 
     673            sleep(1) 
     674 
     675            mkdir(bardir) 
     676            again = join(bardir, 'again') 
     677            open(again, "w").close() 
     678 
     679            cvs.execute('add', bardir, again) 
     680            cvs.execute('commit', '-m', 'four', again) 
     681 
     682    def testCvsReapperedDirectoryToSubversion(self): 
     683        """Test that we can handle resurrected cvs directory to svn.""" 
     684 
     685        t = Tailorizer("svnresurdirtest", self.config) 
     686        t() 
     687 
     688        svnls = ExternalCommand(nolog=False, command=['svn', 'ls']) 
     689        manifest = svnls.execute('file://%s/cvsresurdirtest.svnrepo/test/bar' % self.TESTDIR, 
     690                                 stdout=PIPE)[0] 
     691        self.assertEqual(manifest.read(), "again\n") 
Note: See TracChangeset for help on using the changeset viewer.