Skip to content

Commit

Permalink
Add new unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Jul 26, 2023
1 parent 4518b94 commit bb1a75f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/unit/parsec/test_fileparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from cylc.flow.parsec.fileparse import (
_prepend_old_templatevars,
_get_fpath_for_source,
get_cylc_env_vars,
addict,
addsect,
multiline,
Expand Down Expand Up @@ -736,3 +737,23 @@ def test_get_fpath_for_source(tmp_path):
opts.against_source = True
assert _get_fpath_for_source(
rundir / 'flow.cylc', opts) == str(srcdir / 'flow.cylc')


def test_get_cylc_env_vars(monkeypatch):
"""It should return CYLC env vars but not CYLC_VERSION or CYLC_ENV_NAME."""
monkeypatch.setattr(
'os.environ',
{
"CYLC_VERSION": "betwixt",
"CYLC_ENV_NAME": "between",
"CYLC_QUESTION": "que?",
"CYLC_ANSWER": "42",
"FOO": "foo"
}
)
assert (
get_cylc_env_vars() == {
"CYLC_QUESTION": "que?",
"CYLC_ANSWER": "42",
}
)

0 comments on commit bb1a75f

Please sign in to comment.