Skip to content

Commit

Permalink
Remove MANIC_TEST_TMP_REPO_ROOT environment variable in favor of modu…
Browse files Browse the repository at this point in the history
…le-level variable.
  • Loading branch information
johnpaulalex committed Feb 22, 2023
1 parent 345fc1e commit 5314eed
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test/test_sys_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@


# Module-wide root directory for all the per-test subdirs we'll create on
# the fly.
MANIC_TEST_TMP_REPO_ROOT = 'MANIC_TEST_TMP_REPO_ROOT' # env var name
# the fly (which are placed under wherever $CWD is when the test runs).
# Set by setupModule().
module_tmp_root_dir = None
TMP_REPO_DIR_NAME = 'tmp' # subdir under $CWD

# 'bare repo root' is the test/repos/ subdir that holds all of our
Expand Down Expand Up @@ -136,9 +137,11 @@ def setUpModule(): # pylint: disable=C0103
pass
# create clean dir for this run
os.mkdir(repo_root)
# set into the environment so var will be expanded in externals
# files when executables are run
os.environ[MANIC_TEST_TMP_REPO_ROOT] = repo_root

# Make available to all tests in this file.
global module_tmp_root_dir
assert module_tmp_root_dir == None, module_tmp_root_dir
module_tmp_root_dir = repo_root


class RepoUtils(object):
Expand Down Expand Up @@ -194,8 +197,7 @@ def clone_test_repo(bare_root, test_id, parent_repo_name, dest_dir_in):
# create unique subdir for this test
test_dir_name = test_id
print("Test repository name: {0}".format(test_dir_name))
dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT],
test_dir_name)
dest_dir = os.path.join(module_tmp_root_dir, test_dir_name)
else:
dest_dir = dest_dir_in

Expand Down Expand Up @@ -720,8 +722,8 @@ def test_container_nested_required(self):
orders = [[0, 1, 2], [1, 2, 0], [2, 0, 1],
[0, 2, 1], [2, 1, 0], [1, 0, 2]]
for n, order in enumerate(orders):
dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT],
self._test_id, "test"+str(n))
dest_dir = os.path.join(module_tmp_root_dir, self._test_id,
"test"+str(n))
cloned_repo_dir = self.clone_test_repo(CONTAINER_REPO,
dest_dir_in=dest_dir)
self._generator.create_config()
Expand Down Expand Up @@ -1477,8 +1479,7 @@ def setUp(self):
self._bare_branch_name = 'subrepo_branch'
self._config_branch_name = 'subrepo_config_branch'
self._container_extern_name = 'externals_container.cfg'
self._my_test_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT],
self._test_id)
self._my_test_dir = os.path.join(module_tmp_root_dir, self._test_id)
self._repo_dir = os.path.join(self._my_test_dir, self._test_repo_name)
self._checkout_dir = 'repo_with_submodules'
check_dir = self.clone_test_repo(CONTAINER_REPO,
Expand Down

0 comments on commit 5314eed

Please sign in to comment.