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
98568d49
Unverified
Commit
98568d49
authored
Feb 03, 2023
by
Wagner Macedo
Committed by
GitHub
Feb 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for pyproject with multiple readme files (#6678)
parent
651d82db
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
0 deletions
+120
-0
tests/console/commands/test_build.py
+44
-0
tests/fixtures/with_multiple_readme_files/README-1.rst
+2
-0
tests/fixtures/with_multiple_readme_files/README-2.rst
+2
-0
tests/fixtures/with_multiple_readme_files/my_package/__init__.py
+6
-0
tests/fixtures/with_multiple_readme_files/pyproject.toml
+19
-0
tests/masonry/builders/test_editable_builder.py
+47
-0
No files found.
tests/console/commands/test_build.py
0 → 100644
View file @
98568d49
from
__future__
import
annotations
import
shutil
import
tarfile
from
pathlib
import
Path
from
typing
import
TYPE_CHECKING
from
poetry.factory
import
Factory
if
TYPE_CHECKING
:
from
poetry.utils.env
import
VirtualEnv
from
tests.types
import
CommandTesterFactory
def
test_build_with_multiple_readme_files
(
tmp_path
:
Path
,
tmp_venv
:
VirtualEnv
,
command_tester_factory
:
CommandTesterFactory
):
source_dir
=
(
Path
(
__file__
)
.
parent
.
parent
.
parent
/
"fixtures"
/
"with_multiple_readme_files"
)
target_dir
=
tmp_path
/
"project"
shutil
.
copytree
(
str
(
source_dir
),
str
(
target_dir
))
poetry
=
Factory
()
.
create_poetry
(
target_dir
)
tester
=
command_tester_factory
(
"build"
,
poetry
,
environment
=
tmp_venv
)
tester
.
execute
()
build_dir
=
target_dir
/
"dist"
assert
build_dir
.
exists
()
sdist_file
=
build_dir
/
"my_package-0.1.tar.gz"
assert
sdist_file
.
exists
()
assert
sdist_file
.
stat
()
.
st_size
>
0
(
wheel_file
,)
=
build_dir
.
glob
(
"my_package-0.1-*.whl"
)
assert
wheel_file
.
exists
()
assert
wheel_file
.
stat
()
.
st_size
>
0
sdist_content
=
tarfile
.
open
(
sdist_file
)
.
getnames
()
assert
"my_package-0.1/README-1.rst"
in
sdist_content
assert
"my_package-0.1/README-2.rst"
in
sdist_content
tests/fixtures/with_multiple_readme_files/README-1.rst
0 → 100644
View file @
98568d49
Single Python
=============
tests/fixtures/with_multiple_readme_files/README-2.rst
0 → 100644
View file @
98568d49
Changelog
=========
tests/fixtures/with_multiple_readme_files/my_package/__init__.py
0 → 100644
View file @
98568d49
"""Example module"""
from
__future__
import
annotations
__version__
=
"0.1"
tests/fixtures/with_multiple_readme_files/pyproject.toml
0 → 100644
View file @
98568d49
[tool.poetry]
name
=
"my-package"
version
=
"0.1"
description
=
"Some description."
authors
=
[
"Your Name <you@example.com>"
]
license
=
"MIT"
readme
=
[
"README-1.rst"
,
"README-2.rst"
]
homepage
=
"https://python-poetry.org"
[tool.poetry.dependencies]
python
=
"^2.7"
tests/masonry/builders/test_editable_builder.py
View file @
98568d49
...
@@ -68,6 +68,15 @@ def extended_without_setup_poetry() -> Poetry:
...
@@ -68,6 +68,15 @@ def extended_without_setup_poetry() -> Poetry:
return
poetry
return
poetry
@pytest.fixture
def
with_multiple_readme_files
()
->
Poetry
:
poetry
=
Factory
()
.
create_poetry
(
Path
(
__file__
)
.
parent
.
parent
.
parent
/
"fixtures"
/
"with_multiple_readme_files"
)
return
poetry
@pytest.fixture
()
@pytest.fixture
()
def
env_manager
(
simple_poetry
:
Poetry
)
->
EnvManager
:
def
env_manager
(
simple_poetry
:
Poetry
)
->
EnvManager
:
return
EnvManager
(
simple_poetry
)
return
EnvManager
(
simple_poetry
)
...
@@ -287,6 +296,44 @@ def test_builder_installs_proper_files_when_packages_configured(
...
@@ -287,6 +296,44 @@ def test_builder_installs_proper_files_when_packages_configured(
assert
len
(
paths
)
==
len
(
expected
)
assert
len
(
paths
)
==
len
(
expected
)
def
test_builder_generates_proper_metadata_when_multiple_readme_files
(
with_multiple_readme_files
:
Poetry
,
tmp_venv
:
VirtualEnv
):
builder
=
EditableBuilder
(
with_multiple_readme_files
,
tmp_venv
,
NullIO
())
builder
.
build
()
dist_info
=
"my_package-0.1.dist-info"
assert
tmp_venv
.
site_packages
.
exists
(
dist_info
)
dist_info
=
tmp_venv
.
site_packages
.
find
(
dist_info
)[
0
]
assert
dist_info
.
joinpath
(
"METADATA"
)
.
exists
()
metadata
=
"""
\
Metadata-Version: 2.1
Name: my-package
Version: 0.1
Summary: Some description.
Home-page: https://python-poetry.org
License: MIT
Author: Your Name
Author-email: you@example.com
Requires-Python: >=2.7,<3.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Description-Content-Type: text/x-rst
Single Python
=============
Changelog
=========
"""
assert
dist_info
.
joinpath
(
"METADATA"
)
.
read_text
(
encoding
=
"utf-8"
)
==
metadata
def
test_builder_should_execute_build_scripts
(
def
test_builder_should_execute_build_scripts
(
mocker
:
MockerFixture
,
extended_without_setup_poetry
:
Poetry
,
tmp_path
:
Path
mocker
:
MockerFixture
,
extended_without_setup_poetry
:
Poetry
,
tmp_path
:
Path
):
):
...
...
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