Skip to content

Commit

Permalink
remove some output directories after tests are run
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe committed Dec 17, 2024
1 parent f35803d commit c644209
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/tests/pytests/util/run_util/test_run_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
'INPUT_THRESH',
]

def remove_output_base(config):
config_output_base = config.getdir("OUTPUT_BASE")
if config_output_base and os.path.exists(config_output_base):
ru.shutil.rmtree(config_output_base)

def get_run_util_configs(conf_name):
script_dir = os.path.dirname(__file__)
Expand Down Expand Up @@ -130,6 +134,7 @@ def test_pre_run_setup():
expected_stage = os.path.join(actual.get('config', 'OUTPUT_BASE'), 'stage')
assert actual.get('config', 'STAGING_DIR') == expected_stage
assert actual.get('user_env_vars', 'GODS_OF_WEATHER') == 'Indra_Thor_Zeus'
remove_output_base(actual)


@pytest.mark.util
Expand All @@ -139,6 +144,7 @@ def test_pre_run_setup_env_vars():
actual = ru.pre_run_setup(conf_inputs)
assert actual.env['MY_ENV_VAR'] == '42'
assert actual.get('config', 'OMP_NUM_THREADS') == '4'
remove_output_base(actual)


@pytest.mark.util
Expand Down Expand Up @@ -262,6 +268,7 @@ def test_run_metplus(capfd, config_dict, expected, check_err):
else:
assert err == ''

remove_output_base(config)

@pytest.mark.parametrize(
"side_effect,return_value,check_err",
Expand All @@ -285,6 +292,8 @@ def test_run_metplus_errors(capfd, side_effect, return_value, check_err):
else:
assert err == check_err

remove_output_base(config)


@pytest.mark.util
def test_get_wrapper_instance(metplus_config):
Expand All @@ -308,6 +317,7 @@ def test_get_wrapper_instance_raises(capfd, side_effect, check_err):
assert actual == None
out, err = capfd.readouterr()
assert check_err in err
remove_output_base(config)


@pytest.mark.util
Expand Down

0 comments on commit c644209

Please sign in to comment.