Skip to content

Commit

Permalink
WIP: Add test for move-to-base-dir for when no .gitdist[.default] fil…
Browse files Browse the repository at this point in the history
…e exists (TriBITSPub#203)

Currently, this unit test just causes gitdist to hang until the overall test
times out.
  • Loading branch information
bartlettroscoe committed Nov 3, 2017
1 parent a552da5 commit 1819f0f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/python_utils/gitdist_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1508,5 +1508,42 @@ def test_gitdist_move_to_base_dir(self):
os.chdir(testBaseDir)


def test_gitdist_move_to_base_dir_no_dist_gitdist_file(self):
os.chdir(testBaseDir)
try:

# Create a mock git meta-project but with no .gitdist[.default] files!
testDir = createAndMoveIntoTestDir("gitdist_move_to_base_dir_no_dist_gitdist_file")
os.makedirs(".git")
os.makedirs("ExtraRepo/.git")
os.makedirs("ExtraRepo/path/to/somewhere")
os.chdir("ExtraRepo/path/to/somewhere")

os.environ["GITDIST_MOVE_TO_BASE_DIR"] = ""
cmndOut = GeneralScriptSupport.getCmndOutput(gitdistPathMock+" status")
cmndOut_expected = \
"\n*** Base Git Repo: somewhere\n" \
"['mockgit', 'status']\n\n"
self.assertEqual(s(cmndOut), s(cmndOut_expected))

os.environ["GITDIST_MOVE_TO_BASE_DIR"] = "IMMEDIATE_BASE"
cmndOut = GeneralScriptSupport.getCmndOutput(gitdistPathMock+" status")
cmndOut_expected = \
"\n*** Base Git Repo: somewhere\n" \
"['mockgit', 'status']\n\n"
self.assertEqual(s(cmndOut), s(cmndOut_expected))

os.environ["GITDIST_MOVE_TO_BASE_DIR"] = "EXTREME_BASE"
cmndOut = GeneralScriptSupport.getCmndOutput(gitdistPathMock+" status")
cmndOut_expected = \
"\n*** Base Git Repo: MockProjectDir\n" \
"\n*** Base Git Repo: somewhere\n" \
"['mockgit', 'status']\n\n"
self.assertEqual(s(cmndOut), s(cmndOut_expected))

finally:
os.chdir(testBaseDir)


if __name__ == '__main__':
unittest.main()

0 comments on commit 1819f0f

Please sign in to comment.