def create_dummy_dir(self, newDir): if not self.ok: return topDir = join(self.tempdir, newDir) maybemakedirs(topDir) tmpftpfile = 'a_file' create(join(self.tempdir, tmpftpfile), 'youcoulele') tmpftpfile = 'another_file' create(join(self.tempdir, tmpftpfile), 'warzazat') nestedDir = join(topDir, 'a_dir') mkdir(nestedDir) tmpftpfile = 'a_file' create(join(nestedDir, tmpftpfile), 'youcoulele') tmpftpfile = 'another_file' create(join(nestedDir, tmpftpfile), 'warzazat') return topDir
def create_dummy_dir(self, newDir): ''' This one is duplicated from ftp_utils: We should create a class that inherit unittest.TestCase, with this method in it in test.py. We should take care of the self.tmpdir also. ''' topDir = join(self.tempdir, newDir) maybemakedirs(topDir) # first level tmpftpfile = 'level_1_fileA' create(join(self.tempdir, tmpftpfile), 'youcoulele') tmpftpfile = 'level_1_fileB' create(join(self.tempdir, tmpftpfile), 'warzazat') # second level tmpftpfile = 'level_2_fileA' create(join(topDir, tmpftpfile), 'youcoulele') # third level A nestedDir = join(topDir, 'a_dir') mkdir(nestedDir) tmpftpfile = 'level_3A_fileA' create(join(nestedDir, tmpftpfile), 'youcoulele') tmpftpfile = 'level_3A_fileB' create(join(nestedDir, tmpftpfile), 'warzazat') # third level B nestedDir = join(topDir, 'b_dir') mkdir(nestedDir) tmpftpfile = 'level_3A_fileA' create(join(nestedDir, tmpftpfile), 'makelele') tmpftpfile = 'level_3B_fileB' create(join(nestedDir, tmpftpfile), 'bogoss') return topDir
def create_dummy_dir(self, newDir): ''' This one is duplicated in utils_test: We should create a class that inherit unittest.TestCase, with this method in it in test.py. We should take care of the self.tmpdir also. Here is the dummy tree structure, from topDir ./a_file ./another_file ./a_dir ./a_dir/a_file ./a_dir/another_file ''' if not self.ok: return topDir = join(self.tempdir, newDir) maybemakedirs(topDir) tmpftpfile = 'a_file' create(join(topDir, tmpftpfile), 'youcoulele') tmpftpfile = 'another_file' create(join(topDir, tmpftpfile), 'warzazat') nestedDir = join(topDir, 'a_dir') mkdir(nestedDir) tmpftpfile = 'a_file' create(join(nestedDir, tmpftpfile), 'gouzigouzi') tmpftpfile = 'another_file' create(join(nestedDir, tmpftpfile), 'guacamol') #import commands #outtext = commands.getoutput('(cd %s ; find .)' % topDir) #print outtext return topDir