示例#1
0
 def test_file_package_excludes_excluded_directories(self):
     fp = FilePackage()
     fp.add_directory("dir1")
     fp.add_directories("dir2", "dir3", "dir4", "dir5")
     fp.exclude_directory("dir3")
     fp.exclude_directories("dir4", "dir5")
     eq_(set(("dir1", "dir2")), set(fp.get_directories()))
示例#2
0
    def test_file_package_includes_globbed_directories(self):
        basedir = mkdtemp('-caboose-file-package-tests2')
        dirs = ("1dir", "2dir", "different")
        self.produce_fake_directories(basedir, dirs)

        #create a file package which uses a globbed directory name
        fp = FilePackage()
        fp.set_basedir(basedir)
        fp.add_directory("*dir")

        expected = [os.path.join(basedir, name) for name in ("1dir", "2dir")]
        eq_(set(expected), set(fp.get_directories()))
示例#3
0
    def test_file_package_add_basedir_subdirs(self):
        basedir = mkdtemp('-caboose-file-package-tests')

        expected_dirs = set(("dir1", "dir2", "dir3"))
        self.produce_fake_directories(basedir, expected_dirs)
        expected_dirs = [os.path.join(basedir, name) for name in expected_dirs]

        #add a file which should be ignored as it is not a directory
        filepath = os.path.join(basedir, "file1")
        with open(filepath, 'w') as f:
            f.write("file contents here")

        fp = FilePackage()
        fp.set_basedir(basedir)
        fp.add_directory("*")

        eq_(set(expected_dirs), set(fp.get_directories()))

        rmtree(basedir)
示例#4
0
 def test_file_package_prepends_basedir(self):
     fp = FilePackage()
     fp.set_basedir("/tmp/basedirname")
     fp.add_directories("dir1", "dir2")
     expected = set(("/tmp/basedirname/dir1", "/tmp/basedirname/dir2"))
     eq_(expected, set(fp.get_directories()))
示例#5
0
 def test_file_package_holds_many_directories(self):
     fp = FilePackage()
     fp.add_directory("dir1")
     fp.add_directories("dir2", "dir3")
     eq_(set(("dir1", "dir2", "dir3")), set(fp.get_directories()))