@@ -71,6 +71,36 @@ def test_diff_msg_no_diff() -> None:
71
71
assert Python ._diff_msg ({}, {}) == "python "
72
72
73
73
74
+ @pytest .mark .parametrize (
75
+ ("env" , "base_python" ),
76
+ [
77
+ ("py3" , "py3" ),
78
+ ("py311" , "py311" ),
79
+ ("py3.12" , "py3.12" ),
80
+ ("pypy2" , "pypy2" ),
81
+ ("rustpython3" , "rustpython3" ),
82
+ ("cpython3.8" , "cpython3.8" ),
83
+ ("ironpython2.7" , "ironpython2.7" ),
84
+ ("functional-py310" , "py310" ),
85
+ ("bar-pypy2-foo" , "pypy2" ),
86
+ ("py" , None ),
87
+ ("django-32" , None ),
88
+ ("eslint-8.3" , None ),
89
+ ("py-310" , None ),
90
+ ("py3000" , None ),
91
+ ("4.foo" , None ),
92
+ ("310" , None ),
93
+ ("5" , None ),
94
+ ("2000" , None ),
95
+ ("4000" , None ),
96
+ ],
97
+ ids = lambda a : "|" .join (a ) if isinstance (a , list ) else str (a ),
98
+ )
99
+ def test_extract_base_python (env : str , base_python : str | None ) -> None :
100
+ result = Python .extract_base_python (env )
101
+ assert result == base_python
102
+
103
+
74
104
@pytest .mark .parametrize ("ignore_conflict" , [True , False ])
75
105
@pytest .mark .parametrize (
76
106
("env" , "base_python" ),
@@ -89,16 +119,14 @@ def test_base_python_env_no_conflict(env: str, base_python: list[str], ignore_co
89
119
@pytest .mark .parametrize (
90
120
("env" , "base_python" , "expected" , "conflict" ),
91
121
[
92
- ("cpython" , ["pypy" ], "cpython" , ["pypy" ]),
93
122
("pypy" , ["cpython" ], "pypy" , ["cpython" ]),
94
123
("pypy2" , ["pypy3" ], "pypy2" , ["pypy3" ]),
95
124
("py3" , ["py2" ], "py3" , ["py2" ]),
96
125
("py38" , ["py39" ], "py38" , ["py39" ]),
97
126
("py38" , ["py38" , "py39" ], "py38" , ["py39" ]),
98
127
("py38" , ["python3" ], "py38" , ["python3" ]),
99
128
("py310" , ["py38" , "py39" ], "py310" , ["py38" , "py39" ]),
100
- ("py3.11.1" , ["py3.11.2" ], "py3.11.1" , ["py3.11.2" ]),
101
- ("py3-64" , ["py3-32" ], "py3-64" , ["py3-32" ]),
129
+ ("py3.11" , ["py310" ], "py3.11" , ["py310" ]),
102
130
("py310-magic" , ["py39" ], "py310" , ["py39" ]),
103
131
],
104
132
ids = lambda a : "|" .join (a ) if isinstance (a , list ) else str (a ),
@@ -110,9 +138,6 @@ def test_base_python_env_conflict(
110
138
conflict : list [str ],
111
139
ignore_conflict : bool ,
112
140
) -> None :
113
- if env == "py3-64" :
114
- raise pytest .skip ("bug #2657" )
115
-
116
141
if ignore_conflict :
117
142
result = Python ._validate_base_python (env , base_python , ignore_conflict )
118
143
assert result == [expected ]
0 commit comments