Fix editable installs for project GUI scripts - #10973
Merged
Merged
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/masonry/builders/test_editable_builder.py" line_range="268-277" />
<code_context>
+def test_builder_installs_project_gui_scripts(
</code_context>
<issue_to_address>
**suggestion (testing):** Add a complementary test for non-Windows behavior of `project.gui-scripts`.
This test only covers the Windows branch by forcing `WINDOWS = True` and checking the `.cmd` wrapper. Please also cover the non-Windows branch (e.g., via a second test or parametrization with `WINDOWS = False`) and assert that the `foo-gui` script is created and recorded in `RECORD`, and that no `.cmd` file is created. That way both platform branches of `_add_scripts` for `gui_scripts` are exercised.
Suggested implementation:
```python
@pytest.mark.parametrize("windows", (True, False))
def test_builder_installs_project_gui_scripts(
tmp_path: Path, fixture_dir: FixtureDirGetter, mocker: MockerFixture, windows: bool
) -> None:
```
To fully implement the requested behavior, you should also:
1. Ensure `pytest` is imported at the top of the file if it is not already:
- Add `import pytest` alongside the other imports.
2. Inside `test_builder_installs_project_gui_scripts`, after constructing `poetry` and before running the builder, patch the `WINDOWS` flag used by the editable builder:
- Example:
```python
mocker.patch("poetry.masonry.builders.editable.WINDOWS", windows)
```
- If the module path differs, patch the correct module where `WINDOWS` is defined.
3. After running the builder (whatever code currently triggers script installation), add assertions that depend on `windows`:
- For both branches:
- Assert that the `foo-gui` script is recorded in `RECORD` (likely by inspecting the wheel or record file the test is already checking).
- For `windows is True`:
- Assert that a `foo-gui.cmd` file exists in the venv’s `bin`/`Scripts` directory.
- For `windows is False`:
- Assert that a `foo-gui` script exists (no `.cmd` suffix).
- Assert that no `foo-gui.cmd` file is created.
4. Reuse whatever helpers/fixtures the existing test uses to locate the `bin` directory and `RECORD` file, following the established conventions in this file (e.g., `tmp_venv._bin_dir`, existing assertions from the script test just above).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sanjays2402
reviewed
Jul 21, 2026
Constraint: Preserve the existing console-script wrapper behavior on Windows Confidence: high Scope-risk: narrow Tested: editable builder tests; Ruff format/check; mypy Not-tested: Native Windows process launch
radoering
force-pushed
the
fix-editable-gui-scripts
branch
from
August 1, 2026 05:34
7d19e64 to
cd2abd6
Compare
radoering
approved these changes
Aug 1, 2026
radoering
left a comment
Member
There was a problem hiding this comment.
Thanks for your contribution and @Sanjays2402 thanks for the review. I would have probably miss this one.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #10481
Summary
gui_scriptsentry points during editable installs, alongsideconsole_scripts.[project.gui-scripts], including the Windows.cmdwrapper path.Validation
. .venv/bin/activate && pytest tests/masonry/builders/test_editable_builder.py -q— passed. .venv/bin/activate && ruff format --check src/poetry/masonry/builders/editable.py tests/masonry/builders/test_editable_builder.py— passed. .venv/bin/activate && ruff check src/poetry/masonry/builders/editable.py tests/masonry/builders/test_editable_builder.py— passed. .venv/bin/activate && mypy src/poetry/masonry/builders/editable.py tests/masonry/builders/test_editable_builder.py— passedgit diff --check— passedAdded tests for changed code.
Updated documentation for changed code. Existing docs already say to run
poetry installafter adding GUI scripts.