Skip to content

Commit

Permalink
self install: in this context the project is not a package so we shou…
Browse files Browse the repository at this point in the history
…ld set package-mode
  • Loading branch information
radoering committed Apr 12, 2024
1 parent 2ad0d93 commit 122e219
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/poetry/console/commands/self/self_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def generate_system_pyproject(self) -> None:
package.python_versions = ".".join(str(v) for v in self.env.version_info[:3])

content = Factory.create_pyproject_from_package(package=package)
content["tool"]["poetry"]["package-mode"] = False

for key in preserved:
content["tool"]["poetry"][key] = preserved[key] # type: ignore[index]
Expand Down
32 changes: 32 additions & 0 deletions tests/console/commands/self/test_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from __future__ import annotations

from typing import TYPE_CHECKING

import pytest


if TYPE_CHECKING:
from cleo.testers.command_tester import CommandTester

from tests.types import CommandTesterFactory


@pytest.fixture
def tester(command_tester_factory: CommandTesterFactory) -> CommandTester:
return command_tester_factory("self install")


def test_self_install(
tester: CommandTester,
) -> None:
tester.execute()

expected_output = """\
Updating dependencies
Resolving dependencies...
Writing lock file
"""

assert tester.io.fetch_output() == expected_output
assert tester.io.fetch_error() == ""

0 comments on commit 122e219

Please sign in to comment.