diff options
author | William Lee <wlee@mochify.com> | 2016-11-03 14:45:43 -0400 |
---|---|---|
committer | William Lee <wlee@mochify.com> | 2016-12-08 20:36:13 -0500 |
commit | aceb60ec1d33d3ce1fb49fb6fab74af3e3a1f0ac (patch) | |
tree | 11d269b2ec4cf84c685339d318a764b093939ab4 /python/tidy/servo_tidy_tests/test_tidy.py | |
parent | 289a289da209886f7259c71f279eb11f1c8ba0a3 (diff) | |
download | servo-aceb60ec1d33d3ce1fb49fb6fab74af3e3a1f0ac.tar.gz servo-aceb60ec1d33d3ce1fb49fb6fab74af3e3a1f0ac.zip |
Add tidy linting checks for buildbot_steps.yml
This commit adds tidy checks for buildbot_steps.yml, as well as unit
tests. These checks include:
* Checking buildbot_steps.yml can be parsed by a YAML loader
* buildbot_steps.yml does not contain duplicate keys
* buildbot_steps.yml keys map to a list of strings
Diffstat (limited to 'python/tidy/servo_tidy_tests/test_tidy.py')
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 6dd97aee7e3..12d7b9ebae7 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -177,6 +177,21 @@ class CheckTidiness(unittest.TestCase): self.assertEqual('Unordered key (found b before a)', errors.next()[2]) self.assertNoMoreErrors(errors) + def test_yaml_with_duplicate_key(self): + errors = tidy.collect_errors_for_files(iterFile('duplicate_keys_buildbot_steps.yml'), [tidy.check_yaml], [], print_text=False) + self.assertEqual('Duplicated Key (duplicate_yaml_key)', errors.next()[2]) + self.assertNoMoreErrors(errors) + + def test_non_list_mapped_buildbot_steps(self): + errors = tidy.collect_errors_for_files(iterFile('non_list_mapping_buildbot_steps.yml'), [tidy.check_yaml], [], print_text=False) + self.assertEqual("Key 'non-list-key' maps to type 'str', but list expected", errors.next()[2]) + self.assertNoMoreErrors(errors) + + def test_non_string_list_mapping_buildbot_steps(self): + errors = tidy.collect_errors_for_files(iterFile('non_string_list_buildbot_steps.yml'), [tidy.check_yaml], [], print_text=False) + self.assertEqual("List mapped to 'mapping_key' contains non-string element", errors.next()[2]) + self.assertNoMoreErrors(errors) + def test_lock(self): errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False) msg = """duplicate versions for package "test" |