Esempio n. 1
0
 def test_ensure_abs_path_relative(self):
     current_dir = os.path.abspath(os.getcwd())
     self.addCleanup(os.chdir, current_dir)
     temp_dir = self.makeDir()
     os.chdir(temp_dir)
     file_path = ensure_abs_path("zebra.txt")
     self.assertEqual(file_path, os.path.join(temp_dir, "zebra.txt"))
Esempio n. 2
0
 def test_ensure_abs_path_relative(self):
     current_dir = os.path.abspath(os.getcwd())
     self.addCleanup(os.chdir, current_dir)
     temp_dir = self.makeDir()
     os.chdir(temp_dir)
     file_path = ensure_abs_path("zebra.txt")
     self.assertEqual(file_path, os.path.join(temp_dir, "zebra.txt"))
Esempio n. 3
0
 def test_ensured_abs_path_with_existing(self):
     temp_dir = self.makeDir()
     self.assertTrue(os.path.exists(temp_dir))
     file_path = os.path.join(temp_dir, "zebra.txt")
     self.assertEqual(ensure_abs_path(file_path), file_path)
     self.assertTrue(os.path.exists(temp_dir))
Esempio n. 4
0
 def test_ensure_abs_path_with_stdout_symbol(self):
     self.assertEqual(ensure_abs_path("-"), "-")
Esempio n. 5
0
 def test_ensured_abs_path(self):
     parent_dir = self.makeDir()
     file_path = self.makeFile(dirname=parent_dir)
     os.rmdir(parent_dir)
     self.assertEqual(ensure_abs_path(file_path), file_path)
     self.assertTrue(os.path.exists(parent_dir))
Esempio n. 6
0
 def test_ensured_abs_path_with_existing(self):
     temp_dir = self.makeDir()
     self.assertTrue(os.path.exists(temp_dir))
     file_path = os.path.join(temp_dir, "zebra.txt")
     self.assertEqual(ensure_abs_path(file_path), file_path)
     self.assertTrue(os.path.exists(temp_dir))
Esempio n. 7
0
 def test_ensure_abs_path_with_stdout_symbol(self):
     self.assertEqual(ensure_abs_path("-"), "-")
Esempio n. 8
0
 def test_ensured_abs_path(self):
     parent_dir = self.makeDir()
     file_path = self.makeFile(dirname=parent_dir)
     os.rmdir(parent_dir)
     self.assertEqual(ensure_abs_path(file_path), file_path)
     self.assertTrue(os.path.exists(parent_dir))