Skip to content

Commit

Permalink
Merge pull request #1601 from buildtesters/regtest_change_default_pat…
Browse files Browse the repository at this point in the history
…hs_for_buildtest_environment

buildtest regression test run in unique directory for every CI run
  • Loading branch information
shahzebsiddiqui authored Aug 28, 2023
2 parents 63afa41 + 729032c commit 745a45b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 13 additions & 3 deletions buildtest/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import pwd
import shutil

from rich.console import Console

Expand All @@ -24,8 +25,20 @@
# dictionary used for storing status of builds
USER_SETTINGS_FILE = os.path.join(BUILDTEST_USER_HOME, "config.yml")

# default configuration file
DEFAULT_SETTINGS_FILE = os.path.join(
BUILDTEST_ROOT, "buildtest", "settings", "config.yml"
)

VAR_DIR = os.path.join(BUILDTEST_ROOT, "var")
ci_dir = os.getenv("BUILDTEST_CI_DIR")

if ci_dir:
VAR_DIR = os.path.join(ci_dir, "var")
settings_file = os.path.join(ci_dir, "config.yml")
shutil.copyfile(DEFAULT_SETTINGS_FILE, settings_file)
DEFAULT_SETTINGS_FILE = settings_file


BUILDTEST_LOGFILE = os.path.join(VAR_DIR, "buildtest.log")
DEFAULT_LOGDIR = os.path.join(VAR_DIR, "logs")
Expand All @@ -51,9 +64,6 @@
os.path.join(BUILDTEST_ROOT, "general_tests"),
]

DEFAULT_SETTINGS_FILE = os.path.join(
BUILDTEST_ROOT, "buildtest", "settings", "config.yml"
)
TUTORIALS_SETTINGS_FILE = os.path.join(
BUILDTEST_ROOT, "buildtest", "settings", "spack_container.yaml"
)
Expand Down
7 changes: 7 additions & 0 deletions buildtest/tools/unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
if here not in sys.path:
sys.path.insert(0, here)

import tempfile

import coverage
import pytest

Expand Down Expand Up @@ -36,6 +38,11 @@ def run_unit_tests(pytestopts=None, sourcefiles=None, enable_coverage=False):
"Please check your buildtest installation by running 'source setup.sh'"
)

os.environ["BUILDTEST_CI_DIR"] = tempfile.mkdtemp()

console.rule("Running buildtest unit tests")
console.print("BUILDTEST_CI_DIR", os.getenv("BUILDTEST_CI_DIR"))

pytestopts = pytestopts.split() if pytestopts else []
sources = []

Expand Down

0 comments on commit 745a45b

Please sign in to comment.