Skip to content

Commit

Permalink
Return to starting directory after each test
Browse files Browse the repository at this point in the history
Without this, future tests can fail
  • Loading branch information
billsacks committed Apr 10, 2018
1 parent a385070 commit d1de5f8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/test_sys_repository_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class TestGitRepositoryGitCommands(GitTestCase):
# ========================================================================

def setUp(self):
# directory we want to return to after the test system and
# checkout_externals are done cd'ing all over the place.
self._return_dir = os.getcwd()

self._tmpdir = tempfile.mkdtemp()
os.chdir(self._tmpdir)

Expand All @@ -121,6 +125,9 @@ def setUp(self):
self._repo = GitRepository('test', repo)

def tearDown(self):
# return to our common starting point
os.chdir(self._return_dir)

shutil.rmtree(self._tmpdir, ignore_errors=True)

@staticmethod
Expand Down

0 comments on commit d1de5f8

Please sign in to comment.