Skip to content

Commit

Permalink
Merge remote-tracking branch 'me/feature/parse_w_envars' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Jul 2, 2024
2 parents 65a1624 + dbe0ed5 commit 29c1a3c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

from wxflow import Configuration, cast_as_dtype

SOME_INPUT_ENVVAR1 = "input_envvar"

file0 = """#!/bin/bash
export SOME_ENVVAR1="${USER}"
export SOME_INPUT_ENVVAR1="${SOME_INPUT_ENVVAR1:-}"
export SOME_LOCALVAR1="myvar1"
export SOME_LOCALVAR2="myvar2.0"
export SOME_LOCALVAR3="myvar3_file0"
Expand Down Expand Up @@ -37,6 +40,7 @@

file0_dict = {
'SOME_ENVVAR1': os.environ['USER'],
'SOME_INPUT_ENVVAR1': "",
'SOME_LOCALVAR1': "myvar1",
'SOME_LOCALVAR2': "myvar2.0",
'SOME_LOCALVAR3': "myvar3_file0",
Expand All @@ -59,6 +63,9 @@
'SOME_BOOL6': False
}

file0_dict_set_envvar = file0_dict.copy()
file0_dict_set_envvar["SOME_INPUT_ENVVAR1"] = SOME_INPUT_ENVVAR1

file1_dict = {
'SOME_LOCALVAR3': "myvar3_file1",
'SOME_LOCALVAR4': "myvar4",
Expand Down Expand Up @@ -171,3 +178,10 @@ def test_parse_config2(tmp_path, create_configs):
ff_dict = file0_dict.copy()
ff_dict.update(file1_dict)
assert ff_dict == ff


@pytest.mark.skip(reason="fails in GH runner, passes on localhost")
def test_parse_config_w_envvar(tmp_path, create_configs):
cfg = Configuration(tmp_path)
f0 = cfg.parse_config('config.file0', SOME_INPUT_ENVVAR1=SOME_INPUT_ENVVAR1)
assert file0_dict_set_envvar == f0

0 comments on commit 29c1a3c

Please sign in to comment.