Esempio n. 1
0
 def test_manifest_has_clean_path(self):
     tmpdir = tempfile.gettempdir()
     truth = os.path.join(os.path.realpath(tmpdir), "d1", "d2", "manifest")
     sn = None
     with protect_cwd(tmpdir):
         g = Generator("d1/foo/../d2/manifest", "build_dir")
     self.assertEqual(g.manifest, truth)
 def test_manifest_is_abspath(self):
     with self.assertRaisesRegex(
             ValueError,
             r"^relative path to SubSamurai sub-generator "
             "source: 'build.samurai'$"):
         with protect_cwd(os.path.dirname(self.manifest)):
             SubSamurai(os.path.basename(self.manifest),
                     "/absolute/build_dir")
Esempio n. 3
0
 def test_outside_git_project(self):
     with protect_cwd(self.tmpdir):
         with self.assertRaises(RuntimeError):
             get_git_work_tree()
Esempio n. 4
0
 def test_within_git_project(self):
     with protect_cwd(self.tmpdir):
         subprocess.check_output(("git", "init"))
         self.assertEqual(self.tmpdir, get_git_work_tree())