diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-01-02 07:14:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-02 06:14:51 +0000 |
commit | 516cc2cbca55a1d1505a494875d0c2022ac314c2 (patch) | |
tree | a62f5c27b7027a10b8a2ab6c4b167f78df9cdaeb /python/tidy/test.py | |
parent | f58541e65263daf60d3f5c3f8ad075b09d25223b (diff) | |
download | servo-516cc2cbca55a1d1505a494875d0c2022ac314c2.tar.gz servo-516cc2cbca55a1d1505a494875d0c2022ac314c2.zip |
tidy: A few small improvements and fixes (#30941)
1. Make the tidy output easier to follow
2. Integrate the WPT manifest cleanliness step into tidy
itself and don't run it if nothing has changed in the WPT
directory.
3. Fix an issue where Python test requirements were not installed,
which could cause issues with some modules not being found.
Fixes #30002.
Diffstat (limited to 'python/tidy/test.py')
-rw-r--r-- | python/tidy/test.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/python/tidy/test.py b/python/tidy/test.py index 5690b397a0c..490c77edec9 100644 --- a/python/tidy/test.py +++ b/python/tidy/test.py @@ -16,9 +16,12 @@ from . import tidy BASE_PATH = 'python/tidy/tests/' +def test_file_path(name): + return os.path.join(BASE_PATH, name) + def iterFile(name): - return iter([os.path.join(BASE_PATH, name)]) + return iter([test_file_path(name)]) class CheckTidiness(unittest.TestCase): @@ -35,15 +38,6 @@ class CheckTidiness(unittest.TestCase): self.assertEqual("ignored directory './fake/dir' doesn't exist", next(errors)[2]) self.assertNoMoreErrors(errors) - def test_non_existing_wpt_manifest_checks(self): - wrong_path = "/wrong/path.ini" - errors = tidy.check_manifest_dirs(wrong_path, print_text=False) - self.assertEqual("%s manifest file is required but was not found" % wrong_path, next(errors)[2]) - self.assertNoMoreErrors(errors) - errors = tidy.check_manifest_dirs(os.path.join(BASE_PATH, 'manifest-include.ini'), print_text=False) - self.assertTrue(next(errors)[2].endswith("never_going_to_exist")) - self.assertNoMoreErrors(errors) - def test_directory_checks(self): dirs = { os.path.join(BASE_PATH, "dir_check/webidl_plus"): ['webidl', 'test'], @@ -180,7 +174,7 @@ class CheckTidiness(unittest.TestCase): self.assertNoMoreErrors(errors) def test_lock(self): - errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False) + errors = tidy.check_cargo_lock_file(test_file_path('duplicated_package.lock'), print_text=False) msg = """duplicate versions for package `test` \t\x1b[93mThe following packages depend on version 0.4.9 from 'crates.io':\x1b[0m \t\ttest2 0.1.0 @@ -197,7 +191,7 @@ class CheckTidiness(unittest.TestCase): def test_lock_ignore_without_duplicates(self): tidy.config["ignore"]["packages"] = ["test", "test2", "test3", "test5"] - errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False) + errors = tidy.check_cargo_lock_file(test_file_path('duplicated_package.lock'), print_text=False) msg = ( "duplicates for `test2` are allowed, but only single version found" @@ -215,7 +209,7 @@ class CheckTidiness(unittest.TestCase): def test_lock_exceptions(self): tidy.config["blocked-packages"]["rand"] = ["test_exception", "test_unneeded_exception"] - errors = tidy.collect_errors_for_files(iterFile('blocked_package.lock'), [tidy.check_lock], [], print_text=False) + errors = tidy.check_cargo_lock_file(test_file_path('blocked_package.lock'), print_text=False) msg = ( "Package test_blocked 0.0.2 depends on blocked package rand." |