[PoC] extract build logic from the Command class #10075
Task Summary
Instruction pytest failed in 01:55
Details
✅ 00:03 clone
✅ 00:55 bootstrap_poetry
✅ 00:13 setup_environment
❌ 01:55 pytest
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
-------------- generated xml file: /tmp/cirrus-ci-build/junit.xml --------------
=========================== short test summary info ============================
SKIPPED [1] tests/utils/env/test_env_manager.py:1299: requires darwin
SKIPPED [1] tests/installation/test_executor.py:305: https://github.com/python-poetry/poetry/issues/7983
SKIPPED [1] tests/console/commands/test_sync.py:26: Only relevant for `poetry install`
SKIPPED [1] tests/utils/test_python_manager.py:98: Windows only
SKIPPED [1] tests/console/commands/self/test_sync.py:26: Only relevant for `poetry self install`
SKIPPED [1] tests/integration/test_utils_vcs_git.py:316: HTTP authentication credentials not available
SKIPPED [1] tests/console/commands/test_run.py:88: Poetry only installs CMD script files for console scripts of editable dependencies on Windows
SKIPPED [3] tests/console/commands/env/test_activate.py:52: Only Windows shells
FAILED tests/console/commands/test_build.py::test_build_with_clean_non_existing_output - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_relative_directory_src_layout - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_relative_directory_0/project/dist'
FAILED tests/console/commands/test_build.py::test_build_with_clean[True] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_output_option[None] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_output_option[../dist] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_output_option[test/dir] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_with_clean[False] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_output_option[dist] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_output_option[absolute] - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_with_multiple_readme_files - ValueError: Invalid build format: None
FAILED tests/console/commands/test_build.py::test_build_format_is_not_valid - AssertionError: Regex pattern did not match.
Regex: 'Invalid format.*'
Input: 'Invalid build format: not_valid'
FAILED tests/console/commands/test_build.py::test_build_with_local_version_label - ValueError: Invalid build format: None
=========== 12 failed, 2347 passed, 10 skipped in 112.65s (0:01:52) ============
Annotations
Check failure on line 114 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L114
tests.console.commands.test_build.test_build_with_clean_non_existing_output
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221cb418940>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_clean_non_exis0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c7f9d910>
def test_build_with_clean_non_existing_output(
tmp_tester: CommandTester, tmp_project_path: Path, tmp_poetry: Poetry
) -> None:
dist_dir = tmp_project_path.joinpath("dist")
remove_directory(dist_dir, force=True)
assert not dist_dir.exists()
> tmp_tester.execute("--clean")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c7f9d910>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_clean_non_exis0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221cb418130>, format = None
clean = True, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 213 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L213
tests.console.commands.test_build.test_build_relative_directory_src_layout
Raw output
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_relative_directory_0')
fixture_dir = <function fixture_dir.<locals>._fixture_dir at 0x1221c5ad7700>
def test_build_relative_directory_src_layout(
tmp_path: Path, fixture_dir: FixtureDirGetter
) -> None:
tmp_project_path = tmp_path / "project"
with with_working_directory(fixture_dir("simple_project"), tmp_project_path):
shutil.rmtree(tmp_project_path / "dist")
(tmp_project_path / "src").mkdir()
(tmp_project_path / "simple_project").rename(
tmp_project_path / "src" / "simple_project"
)
# We have to use ApplicationTester because CommandTester
# initializes Poetry before passing the directory.
app = Application()
tester = ApplicationTester(app)
tester.execute("build --project .")
build_dir = tmp_project_path / "dist"
> assert len(list(build_dir.iterdir())) == 2
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:213:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_relative_directory_0/project/dist')
def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
> for name in self._accessor.listdir(self):
E FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_relative_directory_0/project/dist'
/usr/local/lib/python3.9/pathlib.py:1160: FileNotFoundError
Check failure on line 99 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L99
tests.console.commands.test_build.test_build_with_clean[True]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221cb3a3610>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_clean_True_0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c7f964c0>, clean = True
@pytest.mark.parametrize("clean", [True, False])
def test_build_with_clean(
tmp_tester: CommandTester, tmp_project_path: Path, tmp_poetry: Poetry, clean: bool
) -> None:
dist_dir = tmp_project_path.joinpath("dist")
dist_dir.joinpath("hello").touch(exist_ok=True)
> tmp_tester.execute("--clean" if clean else "")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:99:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c7f964c0>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_clean_True_0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221cb3a38b0>, format = None
clean = True, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 180 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L180
tests.console.commands.test_build.test_build_output_option[None]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c9595be0>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_None_0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c6fa7940>, output_dir = None
@pytest.mark.parametrize(
"output_dir", [None, "dist", "test/dir", "../dist", "absolute"]
)
def test_build_output_option(
tmp_tester: CommandTester,
tmp_project_path: Path,
tmp_poetry: Poetry,
output_dir: str,
) -> None:
shutil.rmtree(tmp_project_path / "dist")
if output_dir is None:
> tmp_tester.execute()
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:180:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c6fa7940>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_None_0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c9595370>, format = None
clean = False, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 186 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L186
tests.console.commands.test_build.test_build_output_option[../dist]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c8d69ee0>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option____di0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c8057d60>
output_dir = '../dist'
@pytest.mark.parametrize(
"output_dir", [None, "dist", "test/dir", "../dist", "absolute"]
)
def test_build_output_option(
tmp_tester: CommandTester,
tmp_project_path: Path,
tmp_poetry: Poetry,
output_dir: str,
) -> None:
shutil.rmtree(tmp_project_path / "dist")
if output_dir is None:
tmp_tester.execute()
build_dir = tmp_project_path / "dist"
elif output_dir == "absolute":
tmp_tester.execute(f"--output {tmp_project_path / 'tmp/dist'}")
build_dir = tmp_project_path / "tmp/dist"
else:
> tmp_tester.execute(f"--output {output_dir}")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:186:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c8057d60>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option____di0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c8d69130>, format = None
clean = False, local_version_label = None, output = '../dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 186 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L186
tests.console.commands.test_build.test_build_output_option[test/dir]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c71acc40>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_test_0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c9433940>
output_dir = 'test/dir'
@pytest.mark.parametrize(
"output_dir", [None, "dist", "test/dir", "../dist", "absolute"]
)
def test_build_output_option(
tmp_tester: CommandTester,
tmp_project_path: Path,
tmp_poetry: Poetry,
output_dir: str,
) -> None:
shutil.rmtree(tmp_project_path / "dist")
if output_dir is None:
tmp_tester.execute()
build_dir = tmp_project_path / "dist"
elif output_dir == "absolute":
tmp_tester.execute(f"--output {tmp_project_path / 'tmp/dist'}")
build_dir = tmp_project_path / "tmp/dist"
else:
> tmp_tester.execute(f"--output {output_dir}")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:186:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c9433940>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_test_0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c71ac850>, format = None
clean = False, local_version_label = None, output = 'test/dir'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 99 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L99
tests.console.commands.test_build.test_build_with_clean[False]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c7ead9d0>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_clean_False_0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c8dc5340>, clean = False
@pytest.mark.parametrize("clean", [True, False])
def test_build_with_clean(
tmp_tester: CommandTester, tmp_project_path: Path, tmp_poetry: Poetry, clean: bool
) -> None:
dist_dir = tmp_project_path.joinpath("dist")
dist_dir.joinpath("hello").touch(exist_ok=True)
> tmp_tester.execute("--clean" if clean else "")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:99:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c8dc5340>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_clean_False_0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c7ead760>, format = None
clean = False, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 186 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L186
tests.console.commands.test_build.test_build_output_option[dist]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c8cdb700>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_dist_0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c7ad3cd0>
output_dir = 'dist'
@pytest.mark.parametrize(
"output_dir", [None, "dist", "test/dir", "../dist", "absolute"]
)
def test_build_output_option(
tmp_tester: CommandTester,
tmp_project_path: Path,
tmp_poetry: Poetry,
output_dir: str,
) -> None:
shutil.rmtree(tmp_project_path / "dist")
if output_dir is None:
tmp_tester.execute()
build_dir = tmp_project_path / "dist"
elif output_dir == "absolute":
tmp_tester.execute(f"--output {tmp_project_path / 'tmp/dist'}")
build_dir = tmp_project_path / "tmp/dist"
else:
> tmp_tester.execute(f"--output {output_dir}")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:186:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c7ad3cd0>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_dist_0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c8cdb4f0>, format = None
clean = False, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 183 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L183
tests.console.commands.test_build.test_build_output_option[absolute]
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c9535550>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_absol0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c9535970>
output_dir = 'absolute'
@pytest.mark.parametrize(
"output_dir", [None, "dist", "test/dir", "../dist", "absolute"]
)
def test_build_output_option(
tmp_tester: CommandTester,
tmp_project_path: Path,
tmp_poetry: Poetry,
output_dir: str,
) -> None:
shutil.rmtree(tmp_project_path / "dist")
if output_dir is None:
tmp_tester.execute()
build_dir = tmp_project_path / "dist"
elif output_dir == "absolute":
> tmp_tester.execute(f"--output {tmp_project_path / 'tmp/dist'}")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:183:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c9535970>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_absol0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c9535a90>, format = None
clean = False, local_version_label = None
output = '/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_output_option_absol0/project/tmp/dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 149 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L149
tests.console.commands.test_build.test_build_with_multiple_readme_files
Raw output
fixture_dir = <function fixture_dir.<locals>._fixture_dir at 0x1221c5ad7700>
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_multiple_readm0')
tmp_venv = VirtualEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_multiple_readm0/venv")
command_tester_factory = <function command_tester_factory.<locals>._tester at 0x1221cc1b8ca0>
def test_build_with_multiple_readme_files(
fixture_dir: FixtureDirGetter,
tmp_path: Path,
tmp_venv: VirtualEnv,
command_tester_factory: CommandTesterFactory,
) -> None:
source_dir = fixture_dir("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()
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:149:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c710fca0>
env = VirtualEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_multiple_readm0/venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c7dfd880>, format = None
clean = False, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
Check failure on line 60 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L60
tests.console.commands.test_build.test_build_format_is_not_valid
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c9490460>
def test_build_format_is_not_valid(tmp_tester: CommandTester) -> None:
with pytest.raises(ValueError, match=r"Invalid format.*"):
> tmp_tester.execute("--format not_valid")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c8cf01f0>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_format_is_not_valid0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c9490eb0>
format = 'not_valid', clean = False, local_version_label = None, output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: not_valid
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError
During handling of the above exception, another exception occurred:
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c9490460>
def test_build_format_is_not_valid(tmp_tester: CommandTester) -> None:
with pytest.raises(ValueError, match=r"Invalid format.*"):
> tmp_tester.execute("--format not_valid")
E AssertionError: Regex pattern did not match.
E Regex: 'Invalid format.*'
E Input: 'Invalid build format: not_valid'
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:60: AssertionError
Check failure on line 81 in tests/console/commands/test_build.py
cirrus-ci / Tests / FreeBSD (Python 3.9) / pytest
tests/console/commands/test_build.py#L81
tests.console.commands.test_build.test_build_with_local_version_label
Raw output
tmp_tester = <cleo.testers.command_tester.CommandTester object at 0x1221c51eb280>
tmp_project_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_local_version_0/project')
tmp_poetry = <poetry.poetry.Poetry object at 0x1221c7ca0850>
def test_build_with_local_version_label(
tmp_tester: CommandTester, tmp_project_path: Path, tmp_poetry: Poetry
) -> None:
shutil.rmtree(tmp_project_path / "dist")
local_version_label = "local-version"
> tmp_tester.execute(f"--local-version {local_version_label}")
/tmp/cirrus-ci-build/tests/console/commands/test_build.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/testers/command_tester.py:88: in execute
self._status_code = self._command.run(self._io)
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/base_command.py:117: in run
return self.execute(io) or 0
/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:61: in execute
return self.handle()
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:55: in handle
return self.build(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poetry = <poetry.poetry.Poetry object at 0x1221c7ca0850>
env = MockEnv("/tmp/pytest-of-root/pytest-0/popen-gw1/test_build_with_local_version_0/.venv")
io = <cleo.io.buffered_io.BufferedIO object at 0x1221c51eb5e0>, format = None
clean = False, local_version_label = 'local-version', output = 'dist'
@staticmethod
def build(
poetry: Poetry,
env: Env,
io: IO,
format: str = "all",
clean: bool = True,
local_version_label: str | None = None,
output: str = "dist",
) -> int:
from poetry.masonry.builders import BUILD_FORMATS
if not poetry.is_package_mode:
io.write_error_line(
"Building a package is not possible in non-package mode."
)
return 1
with build_environment(poetry=poetry, env=env, io=io) as env:
dist_dir = Path(output)
package = poetry.package
io.write_line(
f"Building <c1>{package.pretty_name}</c1> (<c2>{package.version}</c2>)"
)
if not dist_dir.is_absolute():
dist_dir = poetry.pyproject_path.parent / dist_dir
if clean:
remove_directory(path=dist_dir, force=True)
if format in BUILD_FORMATS:
builders = [BUILD_FORMATS[format]]
elif format == "all":
builders = list(BUILD_FORMATS.values())
else:
> raise ValueError(f"Invalid build format: {format}")
E ValueError: Invalid build format: None
/tmp/cirrus-ci-build/src/poetry/console/commands/build.py:101: ValueError