@@ -22,46 +22,61 @@ def test_parsing_incorrect():
2222
2323def test_pep_dependency_parsing ():
2424 matplotlib_str = "matplotlib"
25- pkg , features , spec = parse_pep_dependency (matplotlib_str )
25+ pkg , features , spec , env = parse_pep_dependency (matplotlib_str )
2626
2727 assert pkg == "matplotlib" , pkg
2828 assert features is None , features
2929 assert spec is None , spec
30+ assert env is None , env
3031
3132
3233def test_pep_dependency_parsing_with_spec_and_optional_dep ():
3334 matplotlib_str = "matplotlib[foo,bar]>=3.7.0,<4"
34- pkg , features , spec = parse_pep_dependency (matplotlib_str )
35+ pkg , features , spec , env = parse_pep_dependency (matplotlib_str )
3536
3637 assert pkg == "matplotlib" , pkg
3738 assert features == "[foo,bar]" , features
3839 assert spec == SpecifierSet (">=3.7.0,<4" ), spec
40+ assert env is None , env
3941
4042
4143def test_pep_dependency_parsing_with_spec ():
4244 matplotlib_str = "matplotlib>=3.7.0,<4"
43- pkg , features , spec = parse_pep_dependency (matplotlib_str )
45+ pkg , features , spec , env = parse_pep_dependency (matplotlib_str )
4446
4547 assert pkg == "matplotlib" , pkg
4648 assert features is None , features
4749 assert spec == SpecifierSet (">=3.7.0,<4" ), spec
50+ assert env is None , env
4851
4952
5053def test_pep_dependency_parsing_with_url_spec ():
5154 dep_str = "matplotlib @ https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686"
52- pkg , features , spec = parse_pep_dependency (dep_str )
55+ pkg , features , spec , env = parse_pep_dependency (dep_str )
5356
5457 assert pkg == "matplotlib" , pkg
5558 assert features is None , features
5659 assert spec == urlparse (
5760 " https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686"
5861 ), spec
62+ assert env is None , env
5963
6064
6165def test_pep_dependency_parsing_extra_restrictions ():
6266 matplotlib_str = "matplotlib>=3.7.0,<4,!=3.8.14"
63- pkg , features , spec = parse_pep_dependency (matplotlib_str )
67+ pkg , features , spec , env = parse_pep_dependency (matplotlib_str )
6468
6569 assert pkg == "matplotlib" , pkg
6670 assert features is None , features
6771 assert spec == SpecifierSet ("!=3.8.14,<4,>=3.7.0" ), spec
72+ assert env is None , env
73+
74+
75+ def test_pep_dependency_parsing_with_environment_marker ():
76+ matplotlib_str = "matplotlib>=3.7.0,<4;sys_platform != 'win32'"
77+ pkg , features , spec , env = parse_pep_dependency (matplotlib_str )
78+
79+ assert pkg == "matplotlib" , pkg
80+ assert features is None , features
81+ assert spec == SpecifierSet (">=3.7.0,<4" ), spec
82+ assert env == ";sys_platform != 'win32'" , env
0 commit comments