Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete opts after post install #312

Merged
merged 20 commits into from
May 1, 2024

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Apr 16, 2024

Closes cylc/cylc-flow#5968 alongside a cylc/cylc-flow#6068.

Additionally closes cylc/cylc-flow#6058, which was caused by an earlier incomplete solution cylc/cylc-flow#5996

Rose variables should be removed from the options object after post install plugin to prevent them being used by any downstream Cylc Scripts.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim marked this pull request as draft April 16, 2024 12:06
@@ -353,10 +353,3 @@ def broken():
(tmp_path / 'rose-suite.conf').touch()
with pytest.raises(FileNotFoundError):
rose_fileinstall(srcdir=tmp_path, rundir=tmp_path)


def test_cylc_no_rose(tmp_path):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Precisely duplicated test_no_rose_suite_conf_in_devdir at line 60.

@wxtim wxtim force-pushed the fix.delete_opts_after_post-install branch from 7773d76 to 2278f31 Compare April 16, 2024 13:06
@wxtim wxtim self-assigned this Apr 16, 2024
@wxtim wxtim changed the base branch from master to 1.3.x April 16, 2024 13:06
@wxtim wxtim changed the title Fix.delete opts after post install Delete opts after post install Apr 16, 2024
setup.cfg Outdated Show resolved Hide resolved
@wxtim wxtim marked this pull request as ready for review April 16, 2024 14:14
@wxtim wxtim requested a review from MetRonnie April 16, 2024 14:15
@wxtim wxtim modified the milestones: 1.3.x, 1.4.0 Apr 16, 2024
@oliver-sanders oliver-sanders added the bug Something isn't working label Apr 16, 2024
cylc/rose/entry_points.py Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
tests/functional/test_reinstall.py Outdated Show resolved Hide resolved
@oliver-sanders oliver-sanders modified the milestones: 1.4.0, 1.3.x Apr 16, 2024
Comment on lines +145 to +152
if not args or not args.get('workflow_name', ''):
id_ = test_workflow_name()
args = {'workflow_name': id_}

args.update({'no_run_name': True})
options = Options(install_gop(), args)()
output = SimpleNamespace()
output.id = args['workflow_name']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this is going to conflict when merged into master because all the output.ret, output.exc, output.out, etc stuff was stripped in favour of native pytest functionalities.

I think what you've added here mirrors the behaviour on master so should be easy to reconcile.

cylc-rose/tests/conftest.py

Lines 175 to 205 in ed485a8

def _cylc_install_cli(test_dir):
"""Access the install CLI"""
async def _inner(srcpath, workflow_name=None, opts=None):
"""Install a workflow.
Args:
srcpath:
The workflow to install
workflow_name:
The workflow ID prefix to install this workflow as.
If you leave this blank, it will use the module/function's
test directory as appropriate.
opts:
Dictionary of arguments for cylc install.
"""
nonlocal test_dir
if not workflow_name:
workflow_name = str(
(test_dir / str(uuid4())[:4]).relative_to(CYLC_RUN_DIR)
)
options = Options(
install_gop(), opts or {}
)(workflow_name=workflow_name)
if not options.workflow_name:
options.workflow_name = workflow_name
if not opts or not opts.get('no_run_name', ''):
options.no_run_name = True
return await cylc_install(options, str(srcpath))
return _inner

Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
…/cylc-rose into fix.delete_opts_after_post-install

* 'fix.delete_opts_after_post-install' of github.com:wxtim/cylc-rose:
  Update setup.cfg
@wxtim wxtim marked this pull request as ready for review April 25, 2024 08:25
@oliver-sanders
Copy link
Member

@wxtim, tests are still failing I'm afraid.

@wxtim wxtim marked this pull request as draft April 25, 2024 13:37
@wxtim
Copy link
Member Author

wxtim commented Apr 25, 2024

@wxtim, tests are still failing I'm afraid.

I think that I've fixed it.

I don't like the functional testing I've built, but because I don't anticipate there ever being a need for much functional testing I don't think it's worth building anything better.

Cylc Rose should never have needed these tests, and they only demonstrate that it doesn't have functionality it wasn't meant to have.

@wxtim wxtim force-pushed the fix.delete_opts_after_post-install branch from 1fcb22c to 032ba65 Compare April 25, 2024 14:40
@wxtim wxtim force-pushed the fix.delete_opts_after_post-install branch from 032ba65 to 9df1d59 Compare April 25, 2024 14:45
@wxtim wxtim marked this pull request as ready for review April 25, 2024 14:47
cylc/rose/entry_points.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
@MetRonnie
Copy link
Member

I think that I've fixed it.

I don't like the functional testing I've built, but because I don't anticipate there ever being a need for much functional testing I don't think it's worth building anything better.

Cylc Rose should never have needed these tests, and they only demonstrate that it doesn't have functionality it wasn't meant to have.

You seem to have removed the tests you added. At the moment there are no tests added in this PR

tests/conftest.py Outdated Show resolved Hide resolved
@wxtim wxtim marked this pull request as draft April 26, 2024 12:19
@wxtim wxtim marked this pull request as ready for review April 30, 2024 10:05
@wxtim wxtim requested a review from MetRonnie April 30, 2024 10:06
MetRonnies test fix
@wxtim wxtim force-pushed the fix.delete_opts_after_post-install branch from 773e473 to 101e766 Compare April 30, 2024 10:17
Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small suggestions

cylc/rose/entry_points.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
wxtim and others added 2 commits April 30, 2024 11:44
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
@oliver-sanders oliver-sanders merged commit 5073f5b into cylc:1.3.x May 1, 2024
4 of 5 checks passed
@oliver-sanders oliver-sanders modified the milestones: 1.3.x, 1.3.4 May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changed behaviour in handling template variables passed via cli
3 participants