File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -162,13 +162,17 @@ def modules_system(self):
162162 '''
163163 return self ._system .modules_system
164164
165- def get_option (self , option ):
165+ def get_option (self , option , default = None ):
166166 '''Get a configuration option.
167167
168168 :arg option: The option to be retrieved.
169+ :arg default: The value to return if ``option`` cannot be retrieved.
169170 :returns: The value of the option.
171+
172+ .. versionchanged:: 3.11.0
173+ Add ``default`` named argument.
170174 '''
171- return self ._site_config .get (option )
175+ return self ._site_config .get (option , default = default )
172176
173177
174178# Global resources for the current host
Original file line number Diff line number Diff line change @@ -772,8 +772,11 @@ def restrict_logging():
772772 if config_param == 'all' :
773773 printer .info (str (rt .site_config ))
774774 else :
775- value = rt .get_option (config_param )
776- if value is None :
775+ # Create a unique value to differentiate between configuration
776+ # parameters with value `None` and invalid ones
777+ default = {'token' }
778+ value = rt .get_option (config_param , default )
779+ if value is default :
777780 printer .error (
778781 f'no such configuration parameter found: { config_param } '
779782 )
Original file line number Diff line number Diff line change 571571 "systems/partitions/max_jobs" : 8 ,
572572 "systems/partitions/prepare_cmds" : [],
573573 "systems/partitions/processor" : {},
574+ "systems/partitions/time_limit" : null ,
574575 "systems/partitions/devices" : [],
575576 "systems/partitions/extras" : {}
576577 }
Original file line number Diff line number Diff line change @@ -620,6 +620,17 @@ def test_show_config_unknown_param(run_reframe):
620620 assert returncode == 0
621621
622622
623+ def test_show_config_null_param (run_reframe ):
624+ returncode , stdout , stderr = run_reframe (
625+ more_options = ['--show-config=general/report_junit' ],
626+ system = 'testsys'
627+ )
628+ assert 'null' in stdout
629+ assert 'Traceback' not in stdout
630+ assert 'Traceback' not in stderr
631+ assert returncode == 0
632+
633+
623634def test_verbosity (run_reframe ):
624635 returncode , stdout , stderr = run_reframe (
625636 more_options = ['-vvvvv' ],
You can’t perform that action at this time.
0 commit comments