Skip to content

Commit

Permalink
gitdist: Move to Base Dir (TriBITSPub#212)
Browse files Browse the repository at this point in the history
Also added a unit test for when GITDIST_MOVE_TO_BASE_DIR is set to some
invalid value.
  • Loading branch information
jmgate committed Nov 3, 2017
1 parent a7637e2 commit 86a4a1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion test/python_utils/gitdist_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def test_dist_help_all_help(self):
assertContainsAllGitdistHelpSections(self, cmndOut)


# Tet that --dist-help --help prints nice error message
# Test that --dist-help --help prints nice error message
def test_dist_help_help(self):
cmndOut = getCmndOutput(gitdistPath+" --dist-help --help")
cmndOut_expected = "gitdist: error: option --dist-help: invalid choice: '--help' (choose from '', 'overview', 'repo-selection-and-setup', 'dist-repo-status', 'repo-versions', 'aliases', 'move-to-base-dir', 'usage-tips', 'script-dependencies', 'all')\n"
Expand Down Expand Up @@ -1430,6 +1430,15 @@ def test_dist_repo_status_extra_args_fail(self):
os.chdir(testBaseDir)


def test_gitdist_move_to_base_dir_invalid_env_var(self):
os.environ["GITDIST_MOVE_TO_BASE_DIR"] = "INVALID"
cmndOut = getCmndOutput(gitdistPath+" status")
cmndOut_expected = "Error, env var GITDIST_MOVE_TO_BASE_DIR='INVALID' is invalid! Valid choices include empty '', IMMEDIATE_BASE, and EXTREME_BASE.\n"
print("cmndOut = ", cmndOut)
print("cmndOut_expected = ", cmndOut_expected)
self.assertEqual(s(cmndOut), s(cmndOut_expected))


def test_gitdist_move_to_base_dir(self):
os.chdir(testBaseDir)
try:
Expand Down
2 changes: 1 addition & 1 deletion tribits/python_utils/gitdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ def getCommandlineOps():
else:
print(
"Error, env var GITDIST_MOVE_TO_BASE_DIR='"+moveToBaseDir+"' is invalid!"
+ " Valid choices include empty '', IMMEDIATE_BASE, and EXTREME_BASE")
+ " Valid choices include empty '', IMMEDIATE_BASE, and EXTREME_BASE.")
sys.exit(1)

#
Expand Down

0 comments on commit 86a4a1d

Please sign in to comment.