Skip to content

fix: use .get() for file script reference and add failure mode tests

a737e65
Select commit
Loading
Failed to load commit list.
Open

Fix file scripts not copied to bin on poetry install #10736

fix: use .get() for file script reference and add failure mode tests
a737e65
Select commit
Loading
Failed to load commit list.
Cirrus CI / Tests / FreeBSD (Python 3.11) / pytest failed Feb 13, 2026 in 4m 13s

Task Summary

Instruction pytest failed in 02:06

Details

✅ 00:04 clone
✅ 01:17 bootstrap_poetry
✅ 00:41 setup_environment
❌ 02:06 pytest

E             - tool.poetry.scripts.no-ref-script must be valid exactly by one definition (0 matches found)

/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.11/lib/python3.11/site-packages/poetry/core/factory.py:58: RuntimeError
___________________ test_builder_skips_directory_file_script ___________________
[gw1] freebsd14 -- Python 3.11.14 /.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.11/bin/python

fixture_dir = <function fixture_dir.<locals>._fixture_dir at 0xe6992a367a0>
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_builder_skips_directory_f0')

    def test_builder_skips_directory_file_script(
        fixture_dir: FixtureDirGetter,
        tmp_path: Path,
    ) -> None:
        from cleo.io.buffered_io import BufferedIO
    
        poetry = Factory().create_poetry(fixture_dir("file_scripts_dir_ref_project"))
        env_manager = EnvManager(poetry)
        venv_path = tmp_path / "venv"
        env_manager.build_venv(venv_path)
        tmp_venv = VirtualEnv(venv_path)
    
        io = BufferedIO()
        builder = EditableBuilder(poetry, tmp_venv, io)
        builder.build()
    
        # The file script for the directory reference must not be created
        script_path = tmp_venv._bin_dir.joinpath("dir-script")
        assert not script_path.exists()
    
        # The error message should be logged
        error_output = io.fetch_error()
        assert "dir-script" in error_output
>       assert "is not a file" in error_output
E       AssertionError: assert 'is not a file' in '  - File script dir-script references bin/some-directory which does not exist\n'

/tmp/cirrus-ci-build/tests/masonry/builders/test_editable_builder.py:516: AssertionError
------------------------------ Captured log call -------------------------------
INFO     virtualenv.discovery.builtin:builtin.py:79 find interpreter for spec PythonSpec(path=/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.11/bin/python)
INFO     virtualenv.discovery.builtin:builtin.py:86 proposed PythonInfo(spec=CPython3.11.14.final.0-64, system=/usr/local/bin/python3.11, exe=/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.11/bin/python, platform=freebsd14, version='3.11.14 (main, Feb  7 2026, 01:05:48) [Clang 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd7080', encoding_fs_io=utf-8-utf-8)
WARNING  virtualenv.seed.embed.base_embed:base_embed.py:38 The --no-wheel and --wheel options are deprecated. They have no effect for Python > 3.8 as wheel is no longer bundled in virtualenv.
INFO     virtualenv.run.session:session.py:52 create virtual environment via CPython3Posix(dest=/tmp/pytest-of-root/pytest-0/popen-gw1/test_builder_skips_directory_f0/venv, clear=False, no_vcs_ignore=False, global=False)
INFO     virtualenv.run.session:session.py:65 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
-------------- generated xml file: /tmp/cirrus-ci-build/junit.xml --------------
=========================== short test summary info ============================
SKIPPED [3] tests/console/commands/env/test_activate.py:54: Only Windows shells
SKIPPED [1] tests/integration/test_utils_vcs_git.py:324: HTTP authentication credentials not available
SKIPPED [1] tests/console/commands/test_sync.py:26: Only relevant for `poetry install`
SKIPPED [1] tests/installation/test_executor.py:506: https://github.com/python-poetry/poetry/issues/7983
SKIPPED [1] tests/utils/test_python_manager.py:104: Windows only
SKIPPED [1] tests/utils/env/test_env_manager.py:1269: requires darwin
SKIPPED [1] tests/console/commands/self/test_sync.py:26: Only relevant for `poetry self install`
SKIPPED [1] tests/console/commands/test_run.py:158: Poetry only installs CMD script files for console scripts of editable dependencies on Windows
FAILED tests/masonry/builders/test_editable_builder.py::test_builder_skips_file_script_missing_reference_field - RuntimeError: The Poetry configuration is invalid:
  - tool.poetry.scripts.no-ref-script must be valid exactly by one definition (0 matches found)
FAILED tests/masonry/builders/test_editable_builder.py::test_builder_skips_directory_file_script - AssertionError: assert 'is not a file' in '  - File script dir-script references bin/some-directory which does not exist\n'
============ 2 failed, 2935 passed, 10 skipped in 123.51s (0:02:03) ============

Annotations

Check failure on line 525 in tests/masonry/builders/test_editable_builder.py

See this annotation in the file changed.

@cirrus-ci cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest

tests/masonry/builders/test_editable_builder.py#L525

tests.masonry.builders.test_editable_builder.test_builder_skips_file_script_missing_reference_field
Raw output
fixture_dir = <function fixture_dir.<locals>._fixture_dir at 0x38b47ec463e0>
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_builder_skips_file_script0')

    def test_builder_skips_file_script_missing_reference_field(
        fixture_dir: FixtureDirGetter,
        tmp_path: Path,
    ) -> None:
        from cleo.io.buffered_io import BufferedIO
    
>       poetry = Factory().create_poetry(
            fixture_dir("file_scripts_no_ref_field_project")
        )

/tmp/cirrus-ci-build/tests/masonry/builders/test_editable_builder.py:525: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/tmp/cirrus-ci-build/src/poetry/factory.py:80: in create_poetry
    base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <poetry.factory.Factory object at 0x38b47de84d10>
cwd = PosixPath('/tmp/cirrus-ci-build/tests/fixtures/file_scripts_no_ref_field_project')
with_groups = True

    def create_poetry(
        self, cwd: Path | None = None, with_groups: bool = True
    ) -> Poetry:
        from poetry.core.poetry import Poetry
        from poetry.core.pyproject.toml import PyProjectTOML
    
        poetry_file = self.locate(cwd)
        pyproject = PyProjectTOML(path=poetry_file)
    
        # Checking validity
        check_result = self.validate(pyproject.data)
        if check_result["errors"]:
            message = ""
            for error in check_result["errors"]:
                message += f"  - {error}\n"
    
>           raise RuntimeError("The Poetry configuration is invalid:\n" + message)
E           RuntimeError: The Poetry configuration is invalid:
E             - tool.poetry.scripts.no-ref-script must be valid exactly by one definition (0 matches found)

/.cache/pypoetry/virtualenvs/poetry-XZqP7kBn-py3.11/lib/python3.11/site-packages/poetry/core/factory.py:58: RuntimeError

Check failure on line 516 in tests/masonry/builders/test_editable_builder.py

See this annotation in the file changed.

@cirrus-ci cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest

tests/masonry/builders/test_editable_builder.py#L516

tests.masonry.builders.test_editable_builder.test_builder_skips_directory_file_script
Raw output
fixture_dir = <function fixture_dir.<locals>._fixture_dir at 0xe6992a367a0>
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_builder_skips_directory_f0')

    def test_builder_skips_directory_file_script(
        fixture_dir: FixtureDirGetter,
        tmp_path: Path,
    ) -> None:
        from cleo.io.buffered_io import BufferedIO
    
        poetry = Factory().create_poetry(fixture_dir("file_scripts_dir_ref_project"))
        env_manager = EnvManager(poetry)
        venv_path = tmp_path / "venv"
        env_manager.build_venv(venv_path)
        tmp_venv = VirtualEnv(venv_path)
    
        io = BufferedIO()
        builder = EditableBuilder(poetry, tmp_venv, io)
        builder.build()
    
        # The file script for the directory reference must not be created
        script_path = tmp_venv._bin_dir.joinpath("dir-script")
        assert not script_path.exists()
    
        # The error message should be logged
        error_output = io.fetch_error()
        assert "dir-script" in error_output
>       assert "is not a file" in error_output
E       AssertionError: assert 'is not a file' in '  - File script dir-script references bin/some-directory which does not exist\n'

/tmp/cirrus-ci-build/tests/masonry/builders/test_editable_builder.py:516: AssertionError