def testDirWalk(self): """directory walking""" fm = FileManager(True) assert os.path.exists("%s/css/.svn" % self.dir) for src, dest in fm.walk("css", "tmp", self.exclude): self.assert_(not re.search(".svn", src)) walk1 = tuple(fm.walk("%s/css" % self.dir, "tmp", self.exclude)) walk2 = tuple(fm.walk("%s/css/" % self.dir, "tmp", self.exclude)) self.assertEqual(walk1, walk2) src, dest = list(fm.walk("%s/danlann" % self.dir, "tmp", self.exclude))[0] self.assert_(dest.startswith("tmp/danlann")) src, dest = list(fm.walk("%s/danlann/test" % self.dir, "tmp", self.exclude))[0] self.assert_(dest.startswith("tmp/test"))
def testDirWalk(self): """directory walking""" fm = FileManager(True) assert os.path.exists('%s/css/.svn' % self.dir) for src, dest in fm.walk('css', 'tmp', self.exclude): self.assert_(not re.search('.svn', src)) walk1 = tuple(fm.walk('%s/css' % self.dir, 'tmp', self.exclude)) walk2 = tuple(fm.walk('%s/css/' % self.dir, 'tmp', self.exclude)) self.assertEqual(walk1, walk2) src, dest = list(fm.walk('%s/danlann' % self.dir, 'tmp', self.exclude))[0] self.assert_(dest.startswith('tmp/danlann')) src, dest = list(fm.walk('%s/danlann/test' % self.dir, 'tmp', self.exclude))[0] self.assert_(dest.startswith('tmp/test'))
def testFileWalk(self): """file walking""" fm = FileManager(True) walk = list(fm.walk("%s/css/danlann.css" % self.dir, "tmp", self.exclude)) src, dest = walk[0] self.assertEqual(len(walk), 1) self.assertEqual(src, "%s/css/danlann.css" % self.dir) self.assertEqual(dest, "tmp")