mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 23:56:13 +01:00
mark boolean and integer_opts as private
It is unused elsewhere, and only used for unit-testing
This commit is contained in:
parent
fb44c5720e
commit
adb1a9b4ef
19
osc/conf.py
19
osc/conf.py
@ -186,28 +186,29 @@ if not os.path.isfile('/usr/bin/build') and os.path.isfile('/usr/bin/obs-build')
|
||||
if not os.path.isfile('/usr/lib/build/vc') and os.path.isfile('/usr/lib/obs-build/vc'):
|
||||
DEFAULTS['vc-cmd'] = '/usr/lib/obs-build/vc'
|
||||
|
||||
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist',
|
||||
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
|
||||
'request_show_source_buildstatus', 'review_inherit_group', 'use_keyring', 'no_verify', 'builtin_signature_check',
|
||||
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage',
|
||||
'status_mtime_heuristic', 'print_web_links', 'ccache', 'sccache', 'build-shell-after-fail']
|
||||
integer_opts = ['build-jobs']
|
||||
|
||||
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj',
|
||||
'downloadurl', 'sshkey']
|
||||
|
||||
_integer_opts = ('build-jobs',)
|
||||
_boolean_opts = (
|
||||
'debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist',
|
||||
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
|
||||
'request_show_source_buildstatus', 'review_inherit_group', 'use_keyring', 'no_verify', 'builtin_signature_check',
|
||||
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage',
|
||||
'status_mtime_heuristic', 'print_web_links', 'ccache', 'sccache', 'build-shell-after-fail')
|
||||
|
||||
|
||||
def apply_option_types(config, conffile=""):
|
||||
"""
|
||||
Return a copy of `config` dictionary with values converted to their expected types
|
||||
according to the enumerated option types (boolean_opts, integer_opts).
|
||||
according to the enumerated option types (_boolean_opts, _integer_opts).
|
||||
"""
|
||||
config = config.copy()
|
||||
|
||||
cp = OscConfigParser.OscConfigParser(config)
|
||||
cp.add_section("general")
|
||||
|
||||
typed_opts = ((boolean_opts, cp.getboolean), (integer_opts, cp.getint))
|
||||
typed_opts = ((_boolean_opts, cp.getboolean), (_integer_opts, cp.getint))
|
||||
for opts, meth in typed_opts:
|
||||
for opt in opts:
|
||||
try:
|
||||
|
@ -14,29 +14,25 @@ class TestConf(unittest.TestCase):
|
||||
importlib.reload(osc.conf)
|
||||
|
||||
def test_bool_opts_defaults(self):
|
||||
opts = osc.conf.boolean_opts
|
||||
config = osc.conf.config
|
||||
for opt in opts:
|
||||
for opt in osc.conf._boolean_opts:
|
||||
self.assertIsInstance(config[opt], bool, msg=f"option: '{opt}'")
|
||||
|
||||
def test_int_opts_defaults(self):
|
||||
opts = osc.conf.integer_opts
|
||||
config = osc.conf.config
|
||||
for opt in opts:
|
||||
for opt in osc.conf._integer_opts:
|
||||
self.assertIsInstance(config[opt], int, msg=f"option: '{opt}'")
|
||||
|
||||
def test_bool_opts(self):
|
||||
osc.conf.get_config()
|
||||
opts = osc.conf.boolean_opts
|
||||
config = osc.conf.config
|
||||
for opt in opts:
|
||||
for opt in osc.conf._boolean_opts:
|
||||
self.assertIsInstance(config[opt], bool, msg=f"option: '{opt}'")
|
||||
|
||||
def test_int_opts(self):
|
||||
osc.conf.get_config()
|
||||
opts = osc.conf.integer_opts
|
||||
config = osc.conf.config
|
||||
for opt in opts:
|
||||
for opt in osc.conf._integer_opts:
|
||||
self.assertIsInstance(config[opt], int, msg=f"option: '{opt}'")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user