10
10
if TYPE_CHECKING :
11
11
from cleo .testers .command_tester import CommandTester
12
12
13
+ from poetry .poetry import Poetry
13
14
from tests .types import CommandTesterFactory
15
+ from tests .types import FixtureDirGetter
16
+ from tests .types import ProjectFactory
14
17
15
18
16
19
@pytest .fixture ()
@@ -23,6 +26,18 @@ def tester(command_tester_factory: CommandTesterFactory) -> CommandTester:
23
26
return command_tester_factory ("version" )
24
27
25
28
29
+ @pytest .fixture
30
+ def poetry_with_underscore (
31
+ project_factory : ProjectFactory , fixture_dir : FixtureDirGetter
32
+ ) -> Poetry :
33
+ source = fixture_dir ("simple_project" )
34
+ pyproject_content = (source / "pyproject.toml" ).read_text (encoding = "utf-8" )
35
+ pyproject_content = pyproject_content .replace ("simple-project" , "simple_project" )
36
+ return project_factory (
37
+ "project_with_underscore" , pyproject_content = pyproject_content
38
+ )
39
+
40
+
26
41
@pytest .mark .parametrize (
27
42
"version, rule, expected" ,
28
43
[
@@ -79,6 +94,14 @@ def test_version_show(tester: CommandTester) -> None:
79
94
assert tester .io .fetch_output () == "simple-project 1.2.3\n "
80
95
81
96
97
+ def test_version_show_with_underscore (
98
+ command_tester_factory : CommandTesterFactory , poetry_with_underscore : Poetry
99
+ ) -> None :
100
+ tester = command_tester_factory ("version" , poetry = poetry_with_underscore )
101
+ tester .execute ()
102
+ assert tester .io .fetch_output () == "simple_project 1.2.3\n "
103
+
104
+
82
105
def test_short_version_show (tester : CommandTester ) -> None :
83
106
tester .execute ("--short" )
84
107
assert tester .io .fetch_output () == "1.2.3\n "
0 commit comments