From bcb4bd2f3013ef8c415cf0f69143347a0cc6f78b Mon Sep 17 00:00:00 2001 From: Timur Borkhodoev Date: Thu, 1 Feb 2018 15:57:11 -0500 Subject: [PATCH] Add self-test and modify tidy to accomodate the test --- python/tidy/servo_tidy/tidy.py | 4 ++-- python/tidy/servo_tidy_tests/test_tidy.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 5a050d11f4a2..fa3a610a41d7 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -461,8 +461,8 @@ def rec_parse(current_path, current_node): def check_manifest_dirs(config_file, print_text=True): if not os.path.exists(config_file): - print("%s manifest file is required but was not found" % config_file) - sys.exit(1) + yield(config_file, 0, "%s manifest file is required but was not found" % config_file) + return # Load configs from include.ini with open(config_file) as content: diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 432d5c1117e8..1c4a055a6652 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -33,6 +33,11 @@ def test_tidy_config(self): self.assertEqual("ignored directory './fake/dir' doesn't exist", errors.next()[2]) self.assertNoMoreErrors(errors) + def test_wpt_manifest_checks(self): + wrong_path = "/wrong/path.ini" + errors = tidy.check_manifest_dirs(wrong_path) + self.assertEqual("%s manifest file is required but was not found" % wrong_path, errors.next()[2]) + def test_directory_checks(self): dirs = { os.path.join(base_path, "dir_check/webidl_plus"): ['webidl', 'test'],