diff --git a/tests/unit/parsec/test_fileparse.py b/tests/unit/parsec/test_fileparse.py index 04b7245f492..a4bdbcb8ea8 100644 --- a/tests/unit/parsec/test_fileparse.py +++ b/tests/unit/parsec/test_fileparse.py @@ -34,6 +34,7 @@ from cylc.flow.parsec.fileparse import ( _prepend_old_templatevars, _get_fpath_for_source, + get_cylc_env_vars, addict, addsect, multiline, @@ -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", + } + )