Change the check_pyyaml() function to return the features of pyyaml that we check

pull/64367/head
Toshio Kuratomi 6 years ago
parent ece306b201
commit 2b6d94c4c8

@ -123,14 +123,14 @@ def check_pyyaml(args, version):
:type args: EnvironmentConfig :type args: EnvironmentConfig
:type version: str :type version: str
""" """
if version in CHECK_YAML_VERSIONS: try:
return return CHECK_YAML_VERSIONS[version]
except KeyError:
pass
python = find_python(version) python = find_python(version)
stdout, _dummy = run_command(args, [python, os.path.join(ANSIBLE_TEST_DATA_ROOT, 'yamlcheck.py')], capture=True) stdout, _dummy = run_command(args, [python, os.path.join(ANSIBLE_TEST_DATA_ROOT, 'yamlcheck.py')],
capture=True, always=True)
if args.explain:
return
CHECK_YAML_VERSIONS[version] = result = json.loads(stdout) CHECK_YAML_VERSIONS[version] = result = json.loads(stdout)
@ -141,3 +141,5 @@ def check_pyyaml(args, version):
display.warning('PyYAML is not installed for interpreter: %s' % python) display.warning('PyYAML is not installed for interpreter: %s' % python)
elif not cloader: elif not cloader:
display.warning('PyYAML will be slow due to installation without libyaml support for interpreter: %s' % python) display.warning('PyYAML will be slow due to installation without libyaml support for interpreter: %s' % python)
return result

@ -71,8 +71,8 @@ class YamllintTest(SanitySingleVersion):
:type python_version: str :type python_version: str
:rtype: TestResult :rtype: TestResult
""" """
ansible_util.check_pyyaml(args, python_version) pyyaml_presence = ansible_util.check_pyyaml(args, python_version)
if not ansible_util.CHECK_YAML_VERSIONS[python_version]['cloader']: if not pyyaml_presence['cloader']:
display.warning("Skipping sanity test '%s' due to missing libyaml support in PyYAML." display.warning("Skipping sanity test '%s' due to missing libyaml support in PyYAML."
% self.name) % self.name)
return SanitySkipped(self.name) return SanitySkipped(self.name)

Loading…
Cancel
Save