예제 #1
0
 def test_hidden_dir(self):
     child = mkdtemp(dir=self.root, prefix=".")
     fd, name = mkstemp(dir=child)
     os.close(fd)
     assert list(iter_paths(child)) == []
     assert list(iter_paths(child, skip_hidden=False)) == [name]
     assert list(iter_paths(self.root)) == []
     assert list(iter_paths(self.root, skip_hidden=False)) == [name]
예제 #2
0
 def test_one_file_exclude(self):
     fd, name = mkstemp(dir=self.root)
     os.close(fd)
     assert list(iter_paths(self.root, exclude=[self.root])) == []
     assert list(iter_paths(self.root,
                            exclude=[os.path.dirname(self.root)])) == []
     assert list(iter_paths(self.root, exclude=[name])) == []
     assert list(iter_paths(self.root, exclude=[name + "a"])) == [name]
예제 #3
0
    def test_with_file(self):
        fd, name = mkstemp(dir=self.root)
        os.close(fd)
        link = os.path.join(self.root, "foo")
        os.symlink(name, link)

        assert list(iter_paths(self.root)) == [name, name]
        assert list(iter_paths(self.root, exclude=[link])) == [name]
        assert list(iter_paths(self.root, exclude=[name])) == []
예제 #4
0
    def test_with_dir_symlink(self):
        child = mkdtemp(dir=self.root)
        link = os.path.join(self.root, "foo")
        os.symlink(child, link)
        fd, name = mkstemp(dir=link)
        os.close(fd)

        assert name not in list(iter_paths(self.root))
        assert list(iter_paths(link)) == list(iter_paths(child))

        assert list(iter_paths(link, exclude=[link])) == []
        assert list(iter_paths(child, exclude=[child])) == []
        assert list(iter_paths(link, exclude=[child])) == []
예제 #5
0
    def test_hidden_file(self):
        fd, name = mkstemp(dir=self.root, prefix=".")
        os.close(fd)

        assert list(iter_paths(self.root)) == []
예제 #6
0
 def test_one_file(self):
     fd, name = mkstemp(dir=self.root)
     os.close(fd)
     assert list(iter_paths(self.root)) == [name]
예제 #7
0
 def test_empty(self):
     assert list(iter_paths(self.root)) == []