#35 Change back to original dir in tests
Merged 6 years ago by lsedlar. Opened 6 years ago by lsedlar.
lsedlar/pag fix-coverage  into  develop

file modified
+3
@@ -25,6 +25,7 @@ 

          print(cp.stdout)

  

      def setUp(self):

+         self.orig_path = os.getcwd()

          # Create git repository with some basic content

          self.repo = tempfile.mkdtemp(prefix='test_current_branch_')

          self.cmd(['git', 'init'])
@@ -37,6 +38,8 @@ 

  

      def tearDown(self):

          shutil.rmtree(self.repo)

+         # Change back to original working directory

+         os.chdir(self.orig_path)

  

  

  class TestGetDefaultBranch(GitTestCase):

Some of the tests need to run in a clone of a git repo. However we need to make sure we change back to the original working directory. Otherwise generating test coverage fails as it tries to write it into current working dir, which no longer exists.

Pull-Request has been merged by lsedlar

6 years ago
Metadata