Loading poetry/masonry/builders/sdist.py +3 −3 Changes for poetry/masonry/builders/sdist.py: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -56,14 +56,14 @@ class SdistBuilder(Builder): if not target_dir.exists(): target_dir.mkdir(parents=True) target = target_dir / f'{self._package.name}' \ f'-{self._package.version}.tar.gz' target = target_dir / f'{self._package.pretty_name}' \ f'-{self._package.pretty_version}.tar.gz' gz = GzipFile(target.as_posix(), mode='wb') tar = tarfile.TarFile(target.as_posix(), mode='w', fileobj=gz, format=tarfile.PAX_FORMAT) try: tar_dir = f'{self._package.name}-{self._package.version}' tar_dir = f'{self._package.pretty_name}-{self._package.pretty_version}' files_to_add = self.find_files_to_add() Loading tests/masonry/builders/test_sdist.py +31 −0 Changes for tests/masonry/builders/test_sdist.py: 31 added lines, 0 removed lines. Original line number Diff line number Diff line import ast import pytest import shutil from pathlib import Path Loading @@ -8,6 +10,24 @@ from poetry.masonry.builders.sdist import SdistBuilder from tests.helpers import get_dependency fixtures_dir = Path(__file__).parent / 'fixtures' @pytest.fixture(autouse=True) def setup(): clear_samples_dist() yield clear_samples_dist() def clear_samples_dist(): for dist in fixtures_dir.glob('**/dist'): if dist.is_dir(): shutil.rmtree(str(dist)) def project(name): return Path(__file__).parent / 'fixtures' / name Loading Loading @@ -84,3 +104,14 @@ def test_find_files_to_add(): Path('my_package/sub_pkg2/data2/data.json'), Path('pyproject.toml'), ] def test_package(): poetry = Poetry.create(project('complete')) builder = SdistBuilder(poetry) builder.build() sdist = fixtures_dir / 'complete' / 'dist' / 'my-package-1.2.3.tar.gz' assert sdist.exists() Loading
poetry/masonry/builders/sdist.py +3 −3 Changes for poetry/masonry/builders/sdist.py: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -56,14 +56,14 @@ class SdistBuilder(Builder): if not target_dir.exists(): target_dir.mkdir(parents=True) target = target_dir / f'{self._package.name}' \ f'-{self._package.version}.tar.gz' target = target_dir / f'{self._package.pretty_name}' \ f'-{self._package.pretty_version}.tar.gz' gz = GzipFile(target.as_posix(), mode='wb') tar = tarfile.TarFile(target.as_posix(), mode='w', fileobj=gz, format=tarfile.PAX_FORMAT) try: tar_dir = f'{self._package.name}-{self._package.version}' tar_dir = f'{self._package.pretty_name}-{self._package.pretty_version}' files_to_add = self.find_files_to_add() Loading
tests/masonry/builders/test_sdist.py +31 −0 Changes for tests/masonry/builders/test_sdist.py: 31 added lines, 0 removed lines. Original line number Diff line number Diff line import ast import pytest import shutil from pathlib import Path Loading @@ -8,6 +10,24 @@ from poetry.masonry.builders.sdist import SdistBuilder from tests.helpers import get_dependency fixtures_dir = Path(__file__).parent / 'fixtures' @pytest.fixture(autouse=True) def setup(): clear_samples_dist() yield clear_samples_dist() def clear_samples_dist(): for dist in fixtures_dir.glob('**/dist'): if dist.is_dir(): shutil.rmtree(str(dist)) def project(name): return Path(__file__).parent / 'fixtures' / name Loading Loading @@ -84,3 +104,14 @@ def test_find_files_to_add(): Path('my_package/sub_pkg2/data2/data.json'), Path('pyproject.toml'), ] def test_package(): poetry = Poetry.create(project('complete')) builder = SdistBuilder(poetry) builder.build() sdist = fixtures_dir / 'complete' / 'dist' / 'my-package-1.2.3.tar.gz' assert sdist.exists()