Skip to content

Commit

Permalink
Tests: import Cylc option parser Options object to set up options (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim authored Jun 14, 2023
1 parent 21e63f4 commit 336e6ac
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from types import SimpleNamespace

from cylc.flow import __version__ as CYLC_VERSION
from cylc.flow.option_parsers import Options

from cylc.flow.scripts.validate import (
_main as cylc_validate,
Expand Down Expand Up @@ -100,13 +101,7 @@ def _cylc_validate_cli(capsys, caplog):
"""Access the validate CLI"""
def _inner(srcpath, args=None):
parser = validate_gop()
options = parser.get_default_values()
options.__dict__.update({
'templatevars': [], 'templatevars_file': []
})

if args is not None:
options.__dict__.update(args)
options = Options(parser, args)()

output = SimpleNamespace()

Expand Down Expand Up @@ -134,15 +129,7 @@ def _inner(srcpath, args=None):
srcpath:
args: Dictionary of arguments.
"""
parser = install_gop()
options = parser.get_default_values()
options.__dict__.update({
'profile_mode': None, 'templatevars': [], 'templatevars_file': [],
'output': None
})

if args is not None:
options.__dict__.update(args)
options = Options(install_gop(), args)()

output = SimpleNamespace()

Expand All @@ -168,15 +155,7 @@ def _inner(workflow_id, opts=None):
srcpath:
args: Dictionary of arguments.
"""
parser = reinstall_gop()
options = parser.get_default_values()
options.__dict__.update({
'profile_mode': None, 'templatevars': [], 'templatevars_file': [],
'output': None
})

if opts is not None:
options.__dict__.update(opts)
options = Options(reinstall_gop(), opts)()

output = SimpleNamespace()

Expand Down

0 comments on commit 336e6ac

Please sign in to comment.