Ejemplo n.º 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]
Ejemplo n.º 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]
Ejemplo n.º 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])) == []
Ejemplo n.º 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])) == []
Ejemplo n.º 5
0
    def test_hidden_file(self):
        fd, name = mkstemp(dir=self.root, prefix=".")
        os.close(fd)

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