diff options
author | Siddhartha Mishra <sidm1999@gmail.com> | 2019-09-21 18:12:41 +0530 |
---|---|---|
committer | Siddhartha Mishra <sidm1999@gmail.com> | 2019-09-22 14:16:46 +0530 |
commit | aa7ba1a850543a147074ec0c693d7bfcdfda9797 (patch) | |
tree | 4befbac409916500fcf8bb2b6d00666252d03810 /python/tidy/servo_tidy_tests | |
parent | 3ced8d4ddcc7328e27231f9db9ce2f441b01d37e (diff) | |
download | servo-aa7ba1a850543a147074ec0c693d7bfcdfda9797.tar.gz servo-aa7ba1a850543a147074ec0c693d7bfcdfda9797.zip |
report when blocked package exception is not needed
Diffstat (limited to 'python/tidy/servo_tidy_tests')
-rw-r--r-- | python/tidy/servo_tidy_tests/blocked_package.lock | 26 | ||||
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 19 |
2 files changed, 45 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/blocked_package.lock b/python/tidy/servo_tidy_tests/blocked_package.lock new file mode 100644 index 00000000000..521fdfcfb74 --- /dev/null +++ b/python/tidy/servo_tidy_tests/blocked_package.lock @@ -0,0 +1,26 @@ +[root] +name = "servo" +version = "0.0.1" + +[[package]] +name = "test_blocked" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "test_exception" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "test_unneeded_exception" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ +] diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 280190931c2..b7ec67cf9c9 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -229,6 +229,25 @@ class CheckTidiness(unittest.TestCase): self.assertNoMoreErrors(errors) + 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) + + msg = ( + "Package test_blocked 0.0.2 depends on blocked package rand." + ) + + msg2 = ( + "Package test_unneeded_exception is not required to be an exception of blocked package rand." + ) + + self.assertEqual(msg, errors.next()[2]) + self.assertEqual(msg2, errors.next()[2]) + self.assertNoMoreErrors(errors) + + # needed to not raise errors in other test cases + tidy.config["blocked-packages"]["rand"] = [] + def test_lint_runner(self): test_path = base_path + 'lints/' runner = tidy.LintRunner(only_changed_files=False, progress=False) |