[Cvsshell-devel] CVS: cvsshell/testing testcases.py,1.1,1.2
Status: Beta
Brought to you by:
stefanheimann
From: Stefan H. <ste...@us...> - 2002-08-04 17:30:15
|
Update of /cvsroot/cvsshell/cvsshell/testing In directory usw-pr-cvs1:/tmp/cvs-serv2058/testing Modified Files: testcases.py Log Message: more tests... Index: testcases.py =================================================================== RCS file: /cvsroot/cvsshell/cvsshell/testing/testcases.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testcases.py 29 Jul 2002 17:36:49 -0000 1.1 --- testcases.py 4 Aug 2002 17:30:13 -0000 1.2 *************** *** 19,26 **** os.system(cmd) ! class RefreshTestCase(unittest.TestCase): def setUp(self): - print 'setUp' os.mkdir(thisDir) os.chdir(thisDir) --- 19,26 ---- os.system(cmd) ! ! class AbstractTestCase(unittest.TestCase): def setUp(self): os.mkdir(thisDir) os.chdir(thisDir) *************** *** 70,74 **** msg += ' Expected: <%s>, is: <%s>' % (expected, real) unittest.TestCase.assertEqual(self, expected, real, msg) ! def assertEntries(self, expected): entries = self.cvsshell.listing.entries --- 70,74 ---- msg += ' Expected: <%s>, is: <%s>' % (expected, real) unittest.TestCase.assertEqual(self, expected, real, msg) ! def assertEntries(self, expected): entries = self.cvsshell.listing.entries *************** *** 82,98 **** --- 82,106 ---- self.assertEqual(dir, entry.dir, "entry %s is not ok (dir)." % entry.name) i = i+1 + + + class RefreshTestCase(AbstractTestCase): def testRefreshInInvalidDir(self): + print 'start: testRefreshInInvalidDir' self.assertEqual(None, self.cvsshell.listing) os.chdir(thisDir) self.exe('refresh') self.assertEqual(None, self.cvsshell.listing) + print 'end: testRefreshInInvalidDir' def testRefreshWithInvalidArg(self): + print 'start: testRefreshWithInvalidArg' self.assertEqual(None, self.cvsshell.listing) self.exe('refresh foo42') self.assertEqual(None, self.cvsshell.listing) + print 'end: testRefreshWithInvalidArg' def testNonRecursiveRefreshWithoutArg(self): + print 'start: testRefreshWithInvalidArg' self.assertEqual(None, self.cvsshell.listing) self.exe('refresh') *************** *** 104,109 **** --- 112,119 ---- self.assertPathEqual(workingDir, self.cvsshell.listing.rootDir) self.assertPathEqual(workingDir, os.getcwd()) + print 'stop: testRefreshWithInvalidArg' def testRefreshWithArg(self): + print 'start: testRefreshWithArg' self.assertEqual(None, self.cvsshell.listing) self.exe('refresh sample_dir') *************** *** 115,120 **** --- 125,132 ---- self.assertPathEqual(os.path.join(workingDir, 'sample_dir'), self.cvsshell.listing.rootDir) self.assertPathEqual(workingDir, os.getcwd()) + print 'end: testRefreshWithArg' def testRecursiveRefreshWithoutArg(self): + print 'start: testRecursiveRefreshWithoutArg' self.assertEqual(None, self.cvsshell.listing) self.exe('refresh -r') *************** *** 130,138 **** self.assertPathEqual(workingDir, self.cvsshell.listing.rootDir) self.assertPathEqual(workingDir, os.getcwd()) ! if __name__ == '__main__': savedRC = os.path.join(os.environ['HOME'], '.cvsshellrc-saved') try: os.rename(os.path.join(os.environ['HOME'], '.cvsshellrc'), savedRC) --- 142,183 ---- self.assertPathEqual(workingDir, self.cvsshell.listing.rootDir) self.assertPathEqual(workingDir, os.getcwd()) ! print 'end: testRecursiveRefreshWithoutArg' ! + class ShellCommandsTest(AbstractTestCase): + + def _testEmbedIds1_2(self, withParen): + new = os.path.join(workingDir, fNew) + mod = os.path.join(workingDir, fModified) + self.assert_(os.path.exists(new)) + self.assert_(os.path.exists(mod)) + self.exe('refresh') + if withParen: + self.exe('rm [[0,2]]') + else: + self.exe('rm 0,2') + self.assert_(not os.path.exists(new)) + self.assert_(not os.path.exists(mod)) + + def testEmbedIds1(self): + self._testEmbedIds1_2(0) + + def testEmbedIds2(self): + self._testEmbedIds1_2(1) + + def testEmbedIds3(self): + sdir = os.path.join(workingDir, sampleDir) + self.assert_(os.path.exists(sdir)) + self.exe('refresh') + self.exe('rm -r [[4]]') + self.assert_(not os.path.exists(sdir)) + if __name__ == '__main__': savedRC = os.path.join(os.environ['HOME'], '.cvsshellrc-saved') + savedHistory = os.path.join(os.environ['HOME'], '.cvsshell_history-saved') + history = os.path.join(os.environ['HOME'], '.cvsshell_history') + try: os.rename(history, savedHistory) + except: pass try: os.rename(os.path.join(os.environ['HOME'], '.cvsshellrc'), savedRC) *************** *** 140,144 **** --- 185,195 ---- except: restoreRC = 0 + import profile + import pstats unittest.main() + try: + os.unlink(history) + os.rename(savedHistory, history) + except: pass if restoreRC: try: |