Ejemplo n.º 1
0
 def test_file(self):
     path = "./tests/examples/collie.jpg"
     target_path = TargetPath(path)
     self.assertEqual(target_path.get_name(), "collie.jpg")
     self.assertEqual(target_path.get_path(), path)
     self.assertEqual(target_path.get_directory(), "./tests/examples")
     info = target_path.get_info()
     self.assertEqual(info["st_size"], 19863)
     self.assertTrue("st_atime" in info)
     self.assertTrue("st_ctime" in info)
     self.assertTrue("st_mtime" in info)
Ejemplo n.º 2
0
 def test_directory(self):
     path = "./tests/examples/testdirectorydonotinsertmoreitems"
     target_path = TargetPath(path)
     self.assertEqual(target_path.get_name(),
                      "testdirectorydonotinsertmoreitems")
     self.assertEqual(target_path.get_path(), path)
     self.assertEqual(target_path.get_directory(), "./tests/examples")
     info = target_path.get_info()
     self.assertTrue("st_atime" in info)
     self.assertTrue("st_ctime" in info)
     self.assertTrue("st_mtime" in info)
Ejemplo n.º 3
0
    def _check_paths(self, target_path: TargetPath):
        if PATH in self._params:
            if self._paths is None:
                paths_list = self._read_file(self._params[PATH])
                self._paths = []
                for path in paths_list:
                    self._paths.append(os.path.abspath(path))

            path = os.path.abspath(target_path.get_path())
            while path not in ["", ".", ".."]:
                if path in self._paths:
                    self._ignore()
                path = os.path.dirname(path)