Beispiel #1
0
    def test_detect_hidden_paths_incrementally(self):
        tmp_fld = mkdtemp()
        files = [
            touch(tmp_fld, ".test.py"),
            touch(tmp_fld, "test.py"),
            touch(tmp_fld, ".test2.py"),
            touch(tmp_fld, "test2.py")
        ]

        depth = 0
        hidden = True
        ignore_chars = []
        scan_symlink_folders = False
        (accepted, further_args) = \
          detect_paths_incremental(([tmp_fld], depth, hidden, ignore_chars, scan_symlink_folders))

        self.assertEmpty(accepted)
        self.assertEqual(len(further_args), 1)

        (paths, depth, hidden, ignore_chars,
         scan_symlink_folders) = further_args[0]
        self.assertEqualItems(paths, [files[0], files[1], files[2], files[3]])
        self.assertEqual(depth, 1)
        self.assertTrue(hidden)
        self.assertEmpty(ignore_chars)
        self.assertFalse(scan_symlink_folders)

        rmtree(tmp_fld)
Beispiel #2
0
 def test_detect_nonexistent_paths_with_dot_incrementally(self):
   depth = 0
   hidden = False
   ignore_chars = []
   (accepted, further_args) = detect_paths_incremental(([".i-start-with-dot"], depth, hidden,
                                                        ignore_chars))
   self.assertEmpty(accepted)
   self.assertEmpty(further_args)
Beispiel #3
0
 def test_detect_nonexistent_paths_incrementally(self):
     depth = 0
     hidden = False
     ignore_chars = []
     scan_symlink_folders = False
     (accepted, further_args) = detect_paths_incremental(
         (["i-do-not-exist"], depth, hidden, ignore_chars,
          scan_symlink_folders))
     self.assertEmpty(accepted)
     self.assertEmpty(further_args)
Beispiel #4
0
  def test_detect_top_level_paths_incrementally(self):
    tmp_fld = mkdtemp()
    files = [touch(tmp_fld, ".test.py"), touch(tmp_fld, "test.py"), touch(tmp_fld, ".test2.py"),
             touch(tmp_fld, "test2.py")]

    depth = 0
    hidden = False
    ignore_chars = []
    (accepted, further_args) = detect_paths_incremental((files, depth, hidden, ignore_chars))

    self.assertEqualItems(accepted, files)
    self.assertEmpty(further_args)

    rmtree(tmp_fld)