def test_outside_git_project(self): with protect_cwd(self.tmpdir): with self.assertRaises(RuntimeError): get_git_work_tree()
def test_within_git_project(self): with protect_cwd(self.tmpdir): subprocess.check_output(("git", "init")) self.assertEqual(self.tmpdir, get_git_work_tree())