Commit 404d2c3 1 parent c1be08e commit 404d2c3 Copy full SHA for 404d2c3
File tree 2 files changed +63
-0
lines changed
src/poetry/console/commands/self
tests/console/commands/self
2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ def generate_system_pyproject(self) -> None:
73
73
package .python_versions = "." .join (str (v ) for v in self .env .version_info [:3 ])
74
74
75
75
content = Factory .create_pyproject_from_package (package = package )
76
+ content ["tool" ]["poetry" ]["package-mode" ] = False # type: ignore[index]
76
77
77
78
for key in preserved :
78
79
content ["tool" ]["poetry" ][key ] = preserved [key ] # type: ignore[index]
Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ import pytest
6
+
7
+ from poetry .console .commands .self .install import SelfInstallCommand
8
+
9
+
10
+ if TYPE_CHECKING :
11
+ from cleo .testers .command_tester import CommandTester
12
+
13
+ from tests .types import CommandTesterFactory
14
+
15
+
16
+ @pytest .fixture
17
+ def tester (command_tester_factory : CommandTesterFactory ) -> CommandTester :
18
+ return command_tester_factory ("self install" )
19
+
20
+
21
+ @pytest .mark .parametrize (
22
+ "pyproject_content" ,
23
+ (
24
+ None ,
25
+ """\
26
+ [tool.poetry]
27
+ name = "poetry-instance"
28
+ version = "1.2"
29
+ description = ""
30
+ authors = []
31
+ license = ""
32
+ # no package-mode -> defaults to true
33
+
34
+ [tool.poetry.dependencies]
35
+ python = "3.9"
36
+ poetry = "1.2"
37
+ """ ,
38
+ ),
39
+ )
40
+ def test_self_install (
41
+ tester : CommandTester ,
42
+ pyproject_content : str | None ,
43
+ ) -> None :
44
+ command = tester .command
45
+ assert isinstance (command , SelfInstallCommand )
46
+ pyproject_path = command .system_pyproject
47
+ if pyproject_content :
48
+ pyproject_path .write_text (pyproject_content )
49
+ else :
50
+ assert not pyproject_path .exists ()
51
+
52
+ tester .execute ()
53
+
54
+ expected_output = """\
55
+ Updating dependencies
56
+ Resolving dependencies...
57
+
58
+ Writing lock file
59
+ """
60
+
61
+ assert tester .io .fetch_output () == expected_output
62
+ assert tester .io .fetch_error () == ""
You can’t perform that action at this time.
0 commit comments