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
ccd09a29
Commit
ccd09a29
authored
Jan 21, 2023
by
Randy Döring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(tests): avoid unnecessary parsing
parent
66d36520
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
19 deletions
+9
-19
tests/packages/test_locker.py
+9
-19
No files found.
tests/packages/test_locker.py
View file @
ccd09a29
...
@@ -12,7 +12,6 @@ from pathlib import Path
...
@@ -12,7 +12,6 @@ from pathlib import Path
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
import
pytest
import
pytest
import
tomlkit
from
poetry.core.constraints.version
import
Version
from
poetry.core.constraints.version
import
Version
from
poetry.core.packages.package
import
Package
from
poetry.core.packages.package
import
Package
...
@@ -231,9 +230,8 @@ python-versions = "~2.7 || ^3.4"
...
@@ -231,9 +230,8 @@ python-versions = "~2.7 || ^3.4"
content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77"
content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77"
"""
# noqa: E800
"""
# noqa: E800
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
packages
=
locker
.
locked_repository
()
.
packages
packages
=
locker
.
locked_repository
()
.
packages
...
@@ -296,9 +294,8 @@ lock-version = "2.0"
...
@@ -296,9 +294,8 @@ lock-version = "2.0"
content-hash = "123456789"
content-hash = "123456789"
"""
# noqa: E800
"""
# noqa: E800
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
repository
=
locker
.
locked_repository
()
repository
=
locker
.
locked_repository
()
assert
len
(
repository
.
packages
)
==
3
assert
len
(
repository
.
packages
)
==
3
...
@@ -363,9 +360,8 @@ lock-version = "2.0"
...
@@ -363,9 +360,8 @@ lock-version = "2.0"
content-hash = "123456789"
content-hash = "123456789"
"""
# noqa: E800
"""
# noqa: E800
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
repository
=
locker
.
locked_repository
()
repository
=
locker
.
locked_repository
()
assert
len
(
repository
.
packages
)
==
2
assert
len
(
repository
.
packages
)
==
2
...
@@ -405,9 +401,8 @@ lock-version = "2.0"
...
@@ -405,9 +401,8 @@ lock-version = "2.0"
python-versions = "*"
python-versions = "*"
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
"""
"""
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
repository
=
locker
.
locked_repository
()
repository
=
locker
.
locked_repository
()
assert
len
(
repository
.
packages
)
==
1
assert
len
(
repository
.
packages
)
==
1
...
@@ -503,9 +498,8 @@ demo = [
...
@@ -503,9 +498,8 @@ demo = [
{file = "demo-1.0-py3-none-any.whl", hash = "sha256"},
{file = "demo-1.0-py3-none-any.whl", hash = "sha256"},
]
]
"""
"""
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
repository
=
locker
.
locked_repository
()
repository
=
locker
.
locked_repository
()
assert
len
(
repository
.
packages
)
==
5
assert
len
(
repository
.
packages
)
==
5
...
@@ -697,9 +691,8 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
...
@@ -697,9 +691,8 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
"""
"""
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
_
=
locker
.
lock_data
_
=
locker
.
lock_data
...
@@ -729,9 +722,8 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
...
@@ -729,9 +722,8 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
"""
# noqa: E800
"""
# noqa: E800
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
with
pytest
.
raises
(
RuntimeError
,
match
=
"^The lock file is not compatible"
):
with
pytest
.
raises
(
RuntimeError
,
match
=
"^The lock file is not compatible"
):
_
=
locker
.
lock_data
_
=
locker
.
lock_data
...
@@ -824,9 +816,8 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
...
@@ -824,9 +816,8 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
"""
"""
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
caplog
.
set_level
(
logging
.
WARNING
,
logger
=
"poetry.packages.locker"
)
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
_
=
locker
.
lock_data
_
=
locker
.
lock_data
...
@@ -1031,9 +1022,8 @@ python-versions = "*"
...
@@ -1031,9 +1022,8 @@ python-versions = "*"
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
"""
# noqa: E800
"""
# noqa: E800
data
=
tomlkit
.
parse
(
content
)
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
locker
.
lock
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
data
.
as_string
()
)
f
.
write
(
content
)
create_dependency_patch
=
mocker
.
patch
(
create_dependency_patch
=
mocker
.
patch
(
"poetry.factory.Factory.create_dependency"
,
autospec
=
True
"poetry.factory.Factory.create_dependency"
,
autospec
=
True
...
...
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