Tidy: Check Cargo.lock for packages with same version and different sources

This commit is contained in:
UK992 2016-12-24 17:42:20 +01:00
parent 5bd53af960
commit b760578f0f
4 changed files with 61 additions and 50 deletions

View file

@ -15,7 +15,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "test2"
version = "0.1.0"
source = "git+https://github.com/"
source = "git+https://github.com/user/test2#c54edsf"
dependencies = [
"test 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "test3"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "test3"
version = "0.5.1"
source = "git+https://github.com/user/test3#c54edsf"
[[package]]
name = "test4"
version = "0.1.0"
source = "git+https://github.com/user/test4#c54edsf"
dependencies = [
"test3 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "test5"
version = "0.1.0"
source = "git+https://github.com/"
dependencies = [
"test3 0.5.1 (git+https://github.com/user/test3)",
]

View file

@ -200,13 +200,17 @@ class CheckTidiness(unittest.TestCase):
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"
\t\033[93mfound dependency on version 0.4.9\033[0m
\t\033[91mbut highest version is 0.5.1\033[0m
\t\033[93mtry upgrading with\033[0m \033[96m./mach cargo-update -p test:0.4.9\033[0m
\tThe following packages depend on version 0.4.9:
\t\ttest2"""
msg = """duplicate versions for package `test`
\t\x1b[93mThe following packages depend on version 0.4.9 from 'crates.io':\x1b[0m
\t\ttest2
\t\x1b[93mThe following packages depend on version 0.5.1 from 'crates.io':\x1b[0m"""
self.assertEqual(msg, errors.next()[2])
msg2 = """duplicate versions for package `test3`
\t\x1b[93mThe following packages depend on version 0.5.1 from 'crates.io':\x1b[0m
\t\ttest4
\t\x1b[93mThe following packages depend on version 0.5.1 from 'https://github.com/user/test3':\x1b[0m
\t\ttest5"""
self.assertEqual(msg2, errors.next()[2])
self.assertNoMoreErrors(errors)
def test_lint_runner(self):