def testPurgeUntrackedFile(self): clone(self.repodir, self.wc) fileToPurge = os.path.join(self.wc, 'fileToPurge') with file(fileToPurge, 'a') as f: f.write('purgeme') purge(self.wc) self.assertFalse(os.path.exists(fileToPurge))
def testPurgeUntrackedFile(self): clone(self.repodir, self.wc) fileToPurge = os.path.join(self.wc, "fileToPurge") with file(fileToPurge, "a") as f: f.write("purgeme") purge(self.wc) self.assertFalse(os.path.exists(fileToPurge))
def testPurgeTrackedFile(self): clone(self.repodir, self.wc) fileToModify = os.path.join(self.wc, 'hello.txt') with open(fileToModify, 'w') as f: f.write('hello!') purge(self.wc) with open(fileToModify, 'r') as f: content = f.read() self.assertEqual(content, 'hello!')
def testPurgeTrackedFile(self): clone(self.repodir, self.wc) fileToModify = os.path.join(self.wc, "hello.txt") with open(fileToModify, "w") as f: f.write("hello!") purge(self.wc) with open(fileToModify, "r") as f: content = f.read() self.assertEqual(content, "hello!")
def testPurgeVeryLongPath(self): clone(self.repodir, self.wc) # now create a very long path name longPath = self.wc for new_dir in xrange(1, 64): longPath = os.path.join(longPath, str(new_dir)) os.makedirs(longPath) self.assertTrue(os.path.isdir(longPath)) purge(self.wc) self.assertFalse(os.path.isdir(longPath))
def testPurgeAFreshClone(self): clone(self.repodir, self.wc) purge(self.wc) self.assertTrue(os.path.exists(os.path.join(self.wc, 'hello.txt')))
def testPurgeUntrackedDirectory(self): clone(self.repodir, self.wc) directoryToPurge = os.path.join(self.wc, 'directoryTopPurge') os.makedirs(directoryToPurge) purge(directoryToPurge) self.assertFalse(os.path.isdir(directoryToPurge))