Skip to content

Commit 033403a

Browse files
authored
Merge pull request #304 from ExaWorks/fix_bool_test_config_opts
Fix parsing of boolean config options, such as minimal_uploads.
2 parents 5adeece + d310320 commit 033403a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tests/ci_runner.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ def run(*args: str, cwd: Optional[str] = None) -> str:
5959
return p.stdout
6060

6161

62-
def get_conf(conf: Dict[str, str], name: str) -> str:
62+
def get_conf(conf: Dict[str, str], name: str, default: Optional[str] = None) -> str:
6363
if name not in conf:
64-
raise KeyError('Missing configuration option "%s"' % name)
64+
if default is not None:
65+
return default
66+
else:
67+
raise KeyError('Missing configuration option "%s"' % name)
6568
return conf[name]
6669

6770

@@ -118,7 +121,7 @@ def run_branch_tests(conf: Dict[str, str], dir: Path, run_id: str, clone: bool =
118121
args.append('--branch-name-override')
119122
args.append(fake_branch_name)
120123
for opt in ['maintainer_email', 'executors', 'server_url', 'key', 'max_age',
121-
'custom_attributes', 'minimal_uploads']:
124+
'custom_attributes']:
122125
try:
123126
val = get_conf(conf, opt)
124127
args.append('--' + opt.replace('_', '-'))
@@ -128,6 +131,11 @@ def run_branch_tests(conf: Dict[str, str], dir: Path, run_id: str, clone: bool =
128131
# old test cycles from working, if their configs don't contain
129132
# the new options
130133
pass
134+
135+
val = get_conf(conf, 'minimal_uploads', 'false')
136+
if val == 'true':
137+
args.append('--minimal-uploads')
138+
131139
cwd = (dir / 'code') if clone else Path('.')
132140
env = dict(os.environ)
133141
env['PYTHONPATH'] = str(Path('.').resolve() / '.packages') \

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def pytest_addoption(parser):
6666
help='Pretend that the current git branch is this value.')
6767
parser.addoption('--custom-attributes', action='store', default=None,
6868
help='A set of custom attributes to pass to jobs.')
69-
parser.addoption('--minimal-uploads', action='store', default=False,
69+
parser.addoption('--minimal-uploads', action='store_true', default=False,
7070
help='Enables minimal uploads mode, which restricts the information that '
7171
'is uploaded to the test aggregation server. ')
7272

0 commit comments

Comments
 (0)