def test_extend_path_builds_on_given_paths(self): base_dir = self.make_dir() lower_dir = factory.make_name('lower') subdir = factory.make_name('sub') os.makedirs(os.path.join(base_dir, lower_dir, subdir)) self.assertEqual([[lower_dir, subdir]], extend_path(base_dir, [lower_dir]))
def test_extend_path_finds_path_extensions(self): base_dir = self.make_dir() subdirs = [ factory.make_name('subdir-%d' % counter) for counter in range(3) ] for subdir in subdirs: os.makedirs(os.path.join(base_dir, subdir)) self.assertItemsEqual([[os.path.basename(base_dir), subdir] for subdir in subdirs], extend_path(os.path.dirname(base_dir), [os.path.basename(base_dir)]))
def test_extend_path_stops_if_no_subdirs_found(self): self.assertItemsEqual([], extend_path(self.make_dir(), []))