From fd2d3b0b85ffa17ce8799cf2dde4b3ac9c7532be Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Tue, 22 Aug 2023 15:26:19 +0100 Subject: [PATCH] Ensure that a `:suite.rc` is added to the template language when creating defines. --- cylc/rose/stem.py | 5 ++--- tests/unit/test_rose_stem_units.py | 31 +++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/cylc/rose/stem.py b/cylc/rose/stem.py index a5c2b494..3f69baef 100644 --- a/cylc/rose/stem.py +++ b/cylc/rose/stem.py @@ -443,7 +443,6 @@ def process(self): if not self.opts.stem_sources: self.opts.stem_sources = ['.'] self.opts.project = [] - for i, url in enumerate(self.opts.stem_sources): project, url, base, rev, mirror = self._ascertain_project(url) self.opts.stem_sources[i] = url @@ -453,7 +452,7 @@ def process(self): # Get the name of the template section to be used: template_type = get_rose_vars( Path(url) / "rose-stem")["templating_detected"] - self.template_section = f'[{template_type}]' + self.template_section = f'[{template_type}:suite.rc]' # Versions of variables with hostname prepended for working copies url_host = self._prepend_localhost(url) @@ -523,7 +522,7 @@ def process(self): def get_source_opt_from_args(opts, args): """Convert sourcedir given as arg or implied by no arg to - opts.workflow_conf_dir. + opts.workflow_conf_dir.k Possible outcomes: No args given: diff --git a/tests/unit/test_rose_stem_units.py b/tests/unit/test_rose_stem_units.py index 3f0d868f..dbf787c1 100644 --- a/tests/unit/test_rose_stem_units.py +++ b/tests/unit/test_rose_stem_units.py @@ -22,11 +22,12 @@ from types import SimpleNamespace from cylc.rose.stem import ( + _get_rose_stem_opts, ProjectNotFoundException, RoseStemVersionException, RoseSuiteConfNotFoundException, StemRunner, - get_source_opt_from_args + get_source_opt_from_args, ) from metomi.rose.reporter import Reporter @@ -291,3 +292,31 @@ def test__deduce_mirror(): } project = 'someproject' StemRunner._deduce_mirror(source_dict, project) + + +def test_process_template_engine_set_correctly(monkeypatch): + """Defines are correctly assigned a [