Skip to content

Commit

Permalink
handle deprecation of poetry.core.masonry.builder.Builder (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Jan 28, 2024
1 parent 2e122ea commit 0c01c5c
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions tests/masonry/builders/test_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

from poetry.core import __version__
from poetry.core.factory import Factory
from poetry.core.masonry.builder import Builder
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.masonry.builders.wheel import WheelBuilder
from tests.masonry.builders.test_wheel import WHEEL_TAG_REGEX


Expand Down Expand Up @@ -56,8 +57,9 @@ def clear_samples_dist() -> None:
)
def test_wheel_c_extension(project: str, exptected_c_dir: str) -> None:
module_path = fixtures_dir / project
builder = Builder(Factory().create_poetry(module_path))
builder.build(fmt="all")
poetry = Factory().create_poetry(module_path)
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

sdist = fixtures_dir / project / "dist" / "extended-0.1.tar.gz"
assert sdist.exists()
Expand Down Expand Up @@ -110,9 +112,10 @@ def test_complete(no_vcs: bool) -> None:
shutil.copytree(module_path.as_posix(), temporary_dir.as_posix())
module_path = temporary_dir

builder = Builder(Factory().create_poetry(module_path))
poetry = Factory().create_poetry(module_path)
with pytest.warns(DeprecationWarning, match=".* script .* extra"):
builder.build(fmt="all")
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"

Expand Down Expand Up @@ -218,8 +221,9 @@ def test_complete(no_vcs: bool) -> None:

def test_module_src() -> None:
module_path = fixtures_dir / "source_file"
builder = Builder(Factory().create_poetry(module_path))
builder.build(fmt="all")
poetry = Factory().create_poetry(module_path)
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

sdist = module_path / "dist" / "module_src-0.1.tar.gz"

Expand All @@ -238,8 +242,9 @@ def test_module_src() -> None:

def test_package_src() -> None:
module_path = fixtures_dir / "source_package"
builder = Builder(Factory().create_poetry(module_path))
builder.build(fmt="all")
poetry = Factory().create_poetry(module_path)
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

sdist = module_path / "dist" / "package_src-0.1.tar.gz"

Expand All @@ -259,8 +264,9 @@ def test_package_src() -> None:

def test_split_source() -> None:
module_path = fixtures_dir / "split_source"
builder = Builder(Factory().create_poetry(module_path))
builder.build(fmt="all")
poetry = Factory().create_poetry(module_path)
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

sdist = module_path / "dist" / "split_source-0.1.tar.gz"

Expand Down Expand Up @@ -301,8 +307,10 @@ def test_package_with_include(mocker: MockerFixture) -> None:
/ "vcs_excluded.txt"
),
]
builder = Builder(Factory().create_poetry(module_path))
builder.build(fmt="all")

poetry = Factory().create_poetry(module_path)
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

sdist = fixtures_dir / "with-include" / "dist" / "with_include-1.2.3.tar.gz"

Expand Down Expand Up @@ -351,8 +359,9 @@ def test_package_with_include(mocker: MockerFixture) -> None:

def test_respect_format_for_explicit_included_files() -> None:
module_path = fixtures_dir / "exclude-whl-include-sdist"
builder = Builder(Factory().create_poetry(module_path))
builder.build(fmt="all")
poetry = Factory().create_poetry(module_path)
SdistBuilder(poetry).build()
WheelBuilder(poetry).build()

sdist = module_path / "dist" / "exclude_whl_include_sdist-0.1.0.tar.gz"

Expand Down

0 comments on commit 0c01c5c

Please sign in to comment.