@@ -185,3 +185,43 @@ def test_parse_environment(self, monkeypatch):
185185
186186 assert actual_specs == expected_specs
187187 assert actual_warnings == expected_warnings
188+
189+
190+ class TestPixiEnvironment :
191+ @pytest .mark .parametrize (
192+ ["name" , "version_text" , "expected_spec" , "expected_warnings" ],
193+ (
194+ pytest .param (
195+ "a" , "1.2.*" , Spec ("a" , Version ("1.2" )), [], id = "star_pin–no_warnings"
196+ ),
197+ pytest .param (
198+ "b" ,
199+ ">=3.1" ,
200+ Spec ("b" , Version ("3.1" )),
201+ [
202+ "package must be pinned with an exact version: '>=3.1'."
203+ " Using the version as an exact pin instead."
204+ ],
205+ id = "lower_pin" ,
206+ ),
207+ pytest .param (
208+ "c" ,
209+ ">=1.6.0,<1.7.0" ,
210+ Spec ("c" , Version ("1.6" )),
211+ [
212+ "lower pin '1.6.0' and upper pin '1.7.0' found."
213+ " Using the lower pin for now, please convert to"
214+ " the standard x.y.* syntax."
215+ ],
216+ id = "tight_pin" ,
217+ ),
218+ ),
219+ )
220+ def test_parse_spec (self , name , version_text , expected_spec , expected_warnings ):
221+ actual_spec , (actual_name , actual_warnings ) = environments .pixi .parse_spec (
222+ name , version_text
223+ )
224+
225+ assert actual_spec == expected_spec
226+ assert actual_name == name
227+ assert actual_warnings == expected_warnings
0 commit comments