From 86a4a1d7b02e5b961c4cd52664615aad9fc0d32b Mon Sep 17 00:00:00 2001 From: "Jason M. Gates" Date: Fri, 3 Nov 2017 10:51:51 -0600 Subject: [PATCH] gitdist: Move to Base Dir (#212) Also added a unit test for when GITDIST_MOVE_TO_BASE_DIR is set to some invalid value. --- test/python_utils/gitdist_UnitTests.py | 11 ++++++++++- tribits/python_utils/gitdist.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/python_utils/gitdist_UnitTests.py b/test/python_utils/gitdist_UnitTests.py index 523f91acc..338e2899a 100644 --- a/test/python_utils/gitdist_UnitTests.py +++ b/test/python_utils/gitdist_UnitTests.py @@ -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" @@ -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: diff --git a/tribits/python_utils/gitdist.py b/tribits/python_utils/gitdist.py index b1e5b0490..74bcd6d59 100755 --- a/tribits/python_utils/gitdist.py +++ b/tribits/python_utils/gitdist.py @@ -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) #