Beispiel #1
0
 def test_os_tree_no_dir(self):
     try:
         reusables.os_tree("I am pretty sure this directory does not exist, at least I hope not, dear goodness")
     except OSError:
         return True
     else:
         assert False
Beispiel #2
0
 def test_os_tree_no_dir(self):
     try:
         reusables.os_tree(
             "I am pretty sure this directory does not exist, at least I hope not, dear goodness"
         )
     except OSError:
         return True
     else:
         assert False
Beispiel #3
0
 def test_os_tree_bad_dir(self):
     lol_Im_not_a_dir = open("fake_dir", "w")
     try:
         reusables.os_tree("fake_dir")
     except OSError:
         return True
     else:
         assert False
     finally:
         lol_Im_not_a_dir.close()
Beispiel #4
0
 def test_os_tree_bad_dir(self):
     lol_Im_not_a_dir = open("fake_dir", "w")
     try:
         reusables.os_tree("fake_dir")
     except OSError:
         return True
     else:
         assert False
     finally:
         lol_Im_not_a_dir.close()
         os.unlink("fake_dir")
Beispiel #5
0
 def test_os_tree(self):
     dir = tempfile.mkdtemp(suffix="dir1")
     dir2 = tempfile.mkdtemp(suffix="dir2", dir=dir)
     without_files = reusables.os_tree(dir)
     answer = {
         dir.replace(tempfile.tempdir, "", 1).lstrip(os.sep): {
             dir2.lstrip(dir).lstrip(os.sep): {}
         }
     }
     assert without_files == answer, "{0} != {1}".format(
         without_files, answer)
Beispiel #6
0
 def test_os_tree(self):
     dir = tempfile.mkdtemp(suffix="dir1")
     dir2 = tempfile.mkdtemp(suffix="dir2", dir=dir)
     without_files = reusables.os_tree(dir)
     answer = {dir.replace(tempfile.tempdir, "", 1).lstrip(os.sep): {dir2.lstrip(dir).lstrip(os.sep): {}}}
     assert without_files == answer, "{0} != {1}".format(without_files, answer)