FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 35f5a8a9 authored by L. Bower's avatar L. Bower
Browse files

adding function to set test outdir as an environemnt variable - so you can...

adding function to set test outdir as an environemnt variable - so you can change the default location, which is hard-coded
parent 87062b7a
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,16 @@ class IntegrationTestUtils:
parser.add_argument('unittest_args', nargs='*')
return parser
@staticmethod
def generate_output_path(filename_prefix: str) -> str:
# if an environment variable "TEST_OUTDIR" is set, use that as the output path
if os.getenv("TEST_OUTDIR"):
result = os.getenv("TEST_OUTDIR") + filename_prefix + "/"
else:
result = IntegrationTestUtils.TEST_WORKSPACE_PATH + filename_prefix + "/"
return result
@staticmethod
def run_full_integration_test_pipeline(test_case: [TestCase],
test_prefix: str,
......
......@@ -45,7 +45,7 @@ class TestAdvisory(BaseAdvisoryTestSuite.AdvisoryTestSuite):
prefix: str = "temp_advisory_" + nowstring
# prefix: str = "temp_advisory"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
os.makedirs(IntegrationTestUtils.TEST_OUT_PATH, exist_ok = True)
sys_config_path = IntegrationTestUtils.DEFAULT_SYS_CONFIG_FILE_PATH
......@@ -57,7 +57,7 @@ class TestAdvisory(BaseAdvisoryTestSuite.AdvisoryTestSuite):
run_config = IntegrationTestUtils.DEFAULT_ADVISORY_CONFIG_FILE_PATH
run_config_dict: dict = IntegrationTestUtils.load_json_file(run_config)
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
# may be reusing a non-timestamped output file during development, so allow extant TEST_OUT_PATH
os.makedirs(IntegrationTestUtils.TEST_OUT_PATH, exist_ok = True)
......
......@@ -46,7 +46,7 @@ class TestDeposition(BaseDepoTestSuite.DepoTestSuite):
# prefix: str = "temp_depo"
# may be reusing a non-timestamped output file during development, so allow extant TEST_OUT_PATH
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
os.makedirs(IntegrationTestUtils.TEST_OUT_PATH, exist_ok = True)
sys_config_path = IntegrationTestUtils.DEFAULT_SYS_CONFIG_FILE_PATH
......
......@@ -46,7 +46,7 @@ class TestEnvSuit(BaseEnvSuitTestSuite.EnvSuitTestSuite):
# prefix: str = "temp_env"
# may be reusing a non-timestamped output file during development, so allow extant TEST_OUT_PATH
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
os.makedirs(IntegrationTestUtils.TEST_OUT_PATH, exist_ok = True)
sys_config_path = IntegrationTestUtils.DEFAULT_SYS_CONFIG_FILE_PATH
......
......@@ -41,7 +41,7 @@ class TestEpi(BaseEpiTestSuite.EpiTestSuite):
prefix: str = "temp_epi_" + nowstring
# prefix: str = "temp_epi"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
os.makedirs(IntegrationTestUtils.TEST_OUT_PATH, exist_ok = True)
sys_config_path = IntegrationTestUtils.DEFAULT_SYS_CONFIG_FILE_PATH
......
......@@ -43,7 +43,7 @@ class TestSurvey(BaseSurveyTestSuite.SurveyTestSuite):
prefix: str = "temp_survey_" + nowstring
# prefix: str = "temp_survey"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
os.makedirs(IntegrationTestUtils.TEST_OUT_PATH, exist_ok = True)
sys_config_path = IntegrationTestUtils.DEFAULT_SYS_CONFIG_FILE_PATH
......@@ -56,7 +56,7 @@ class TestSurvey(BaseSurveyTestSuite.SurveyTestSuite):
run_config = IntegrationTestUtils.DEFAULT_SURVEY_CONFIG_FILE_PATH
run_config_dict: dict = IntegrationTestUtils.load_json_file(run_config)
run_dict: dict = copy.deepcopy(run_config_dict)
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.TEST_WORKSPACE_PATH + prefix + "/"
IntegrationTestUtils.TEST_OUT_PATH = IntegrationTestUtils.generate_output_path(prefix)
run_dict['WORK_PATH'] = IntegrationTestUtils.TEST_OUT_PATH
run_dict['INPUT_PATH'] = IntegrationTestUtils.TEST_OUT_PATH
run_dict['OUTPUT_PATH'] = IntegrationTestUtils.TEST_OUT_PATH
......
temp_*
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment