Only set ONEDIR_TESTRUN if onedir is True

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-01-23 11:47:03 +00:00 committed by Megan Wilhite
parent 16eb2efa10
commit c4fa5a641f
3 changed files with 5 additions and 5 deletions

View file

@ -1045,9 +1045,9 @@ def _pytest(session, coverage, cmd_args, env=None):
def _ci_test(session, transport, onedir=False):
# Install requirements
_install_requirements(session, transport, onedir=onedir)
env = {
"ONEDIR_TESTRUN": "1",
}
env = {}
if onedir:
env["ONEDIR_TESTRUN"] = "1"
chunks = {
"unit": [
"tests/unit",

View file

@ -4,7 +4,7 @@ import sys
_repo_root = pathlib.Path(__file__).parent.parent
if "ONEDIR_TESTRUN" in os.environ:
if os.environ.get("ONEDIR_TESTRUN", "0") == "1":
# In this particular case, we want to make sure that the repo root
# is not part if sys.path so that when we import salt, we import salt from
# the onedir and not the code checkout

View file

@ -801,7 +801,7 @@ def salt_factories_config():
else:
start_timeout = 60
if "ONEDIR_TESTRUN" in os.environ:
if os.environ.get("ONEDIR_TESTRUN", "0") == "1":
code_dir = None
else:
code_dir = str(CODE_DIR)