Skip to content

Commit

Permalink
Log versions of Cylc, Rose and CylcRose in the rose-suite-cylc-instal…
Browse files Browse the repository at this point in the history
…l.conf
  • Loading branch information
wxtim committed May 8, 2024
1 parent 69f321c commit dc6bbcb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cylc/rose/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from cylc.flow.hostuserutil import get_host
from metomi.isodatetime.datetimeoper import DateTimeOperator
from metomi.rose import __version__ as ROSE_VERSION
from cylc.flow import __version__ as CYLC_VERSION
from cylc.rose import __version__ as CYLC_ROSE_VERSION
from metomi.rose.config import (
ConfigDumper,
ConfigLoader,
Expand Down Expand Up @@ -957,6 +959,11 @@ def record_cylc_install_options(
]

cli_config.comments = [' This file records CLI Options.']
cli_config.comments += [
' Installed with:',
f' * Cylc Rose: {CYLC_ROSE_VERSION}',
f' * Rose : {ROSE_VERSION}',
f' * Cylc : {CYLC_VERSION}']
dumper.dump(cli_config, str(conf_filepath))

# Merge the opts section of the rose-suite.conf with those set by CLI:
Expand Down
11 changes: 10 additions & 1 deletion tests/unit/test_functional_post_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_rose_fileinstall_uses_rose_template_vars(tmp_path):
]
)
def test_functional_record_cylc_install_options(
monkeypatch, tmp_path, opts, files, env_inserts
monkeypatch, tmp_path, opts, files, env_inserts, request
):
"""It works the way the proposal says it should.
"""
Expand Down Expand Up @@ -264,6 +264,15 @@ def fake(*arg, **kwargs):
no_ignore=False
)

# Test comments dumped:
# Do this for just one case:
if request.node.callspec.id == 'opts0-files0-env_inserts0':
filetext = (testdir / 'opt/rose-suite-cylc-install.conf').read_text()
assert "Installed with" in filetext
assert "Cylc Rose: 1." in filetext
assert "Cylc : 8." in filetext
assert "Rose : 2." in filetext


def test_functional_rose_database_dumped_correctly(tmp_path):
srcdir = (tmp_path / 'srcdir')
Expand Down

0 comments on commit dc6bbcb

Please sign in to comment.