mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-04 19:26:52 +00:00
Added option to check if the packages in the requirements file(s) include a version string. This lets you enforce a requirement that all your dependency versions be specified to avoid breakage when a package's version changes under you.
This commit is contained in:
parent
dd97157e54
commit
57bf19d519
2 changed files with 49 additions and 7 deletions
|
|
@ -122,9 +122,18 @@ def test_requirement_object():
|
|||
requirement_bar = Requirement()
|
||||
requirement_bar.value = b'bar'
|
||||
|
||||
requirement_baz = Requirement()
|
||||
requirement_baz.value = b'baz>=1.2.3'
|
||||
|
||||
# This may look redundant, but we need to test both foo.__lt__(bar) and
|
||||
# bar.__lt__(foo)
|
||||
assert requirement_foo > top_of_file
|
||||
assert top_of_file < requirement_foo
|
||||
assert requirement_foo > requirement_bar
|
||||
assert requirement_bar < requirement_foo
|
||||
|
||||
# Test the version extraction code
|
||||
assert not requirement_foo.has_version()
|
||||
assert not requirement_bar.has_version()
|
||||
assert requirement_baz.has_version()
|
||||
assert requirement_baz.version == '1.2.3'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue