Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
c2bab89b
Unverified
Commit
c2bab89b
authored
Jul 24, 2020
by
Sébastien Eustace
Committed by
GitHub
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compatibility check for lock files (#2717)
parent
ef8b18a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
+29
-1
poetry/packages/locker.py
+3
-1
tests/packages/test_locker.py
+26
-0
No files found.
poetry/packages/locker.py
View file @
c2bab89b
...
...
@@ -234,8 +234,10 @@ class Locker(object):
lock_version
=
Version
.
parse
(
lock_data
[
"metadata"
]
.
get
(
"lock-version"
,
"1.0"
))
current_version
=
Version
.
parse
(
self
.
_VERSION
)
# We expect the locker to be able to read lock files
# from the same semantic versioning range
accepted_versions
=
parse_constraint
(
"^{}"
.
format
(
Version
(
current_version
.
major
,
current_version
.
minor
))
"^{}"
.
format
(
Version
(
current_version
.
major
,
0
))
)
lock_version_allowed
=
accepted_versions
.
allows
(
lock_version
)
if
lock_version_allowed
and
current_version
<
lock_version
:
...
...
tests/packages/test_locker.py
View file @
c2bab89b
...
...
@@ -340,3 +340,29 @@ A = []
content
=
f
.
read
()
assert
expected
==
content
def
test_locker_should_neither_emit_warnings_nor_raise_error_for_lower_compatible_versions
(
locker
,
caplog
):
current_version
=
Version
.
parse
(
Locker
.
_VERSION
)
older_version
=
"."
.
join
(
[
str
(
current_version
.
major
),
str
(
current_version
.
minor
-
1
)]
)
content
=
"""
\
[metadata]
content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77"
lock-version = "{version}"
python-versions = "~2.7 || ^3.4"
[metadata.files]
"""
.
format
(
version
=
older_version
)
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
locker
.
lock
.
write
(
tomlkit
.
parse
(
content
))
_
=
locker
.
lock_data
assert
0
==
len
(
caplog
.
records
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment