@@ -106,13 +106,22 @@ def test_validates_valid_pep440_version(self, version):
106
106
form , field = pretend .stub (), pretend .stub (data = version )
107
107
legacy ._validate_pep440_version (form , field )
108
108
109
- @pytest .mark .filterwarnings ("ignore:Creating a LegacyVersion.*:DeprecationWarning" )
110
- @pytest .mark .parametrize ("version" , ["dog" , "1.0.dev.a1" , "1.0+local" ])
109
+ @pytest .mark .parametrize ("version" , ["dog" , "1.0.dev.a1" ])
111
110
def test_validates_invalid_pep440_version (self , version ):
112
111
form , field = pretend .stub (), pretend .stub (data = version )
113
- with pytest .raises (ValidationError ):
112
+ with pytest .raises (ValidationError ) as e :
113
+ legacy ._validate_pep440_version (form , field )
114
+
115
+ assert str (e .value ) == "Invalid PEP 440 version."
116
+
117
+ @pytest .mark .parametrize ("version" , ["1.0+local" ])
118
+ def test_validates_local_pep440_version (self , version ):
119
+ form , field = pretend .stub (), pretend .stub (data = version )
120
+ with pytest .raises (ValidationError ) as e :
114
121
legacy ._validate_pep440_version (form , field )
115
122
123
+ assert str (e .value ) == "Can't use PEP 440 local versions."
124
+
116
125
@pytest .mark .parametrize (
117
126
("requirement" , "expected" ),
118
127
[("foo" , ("foo" , None )), ("foo (>1.0)" , ("foo" , ">1.0" ))],
@@ -868,11 +877,9 @@ def test_fails_invalid_version(self, pyramid_config, pyramid_request, version):
868
877
(
869
878
{"metadata_version" : "1.2" , "name" : "example" , "version" : "dog" },
870
879
"'dog' is an invalid value for Version. "
871
- "Error: Start and end with a letter or numeral "
872
- "containing only ASCII numeric and '.', '_' and '-'. "
873
- "See "
874
- "https://packaging.python.org/specifications/core-metadata"
875
- " for more information." ,
880
+ "Error: Invalid PEP 440 version. See "
881
+ "https://packaging.python.org/specifications/core-metadata for "
882
+ "more information." ,
876
883
),
877
884
# filetype/pyversion errors.
878
885
(
@@ -994,7 +1001,6 @@ def test_fails_invalid_version(self, pyramid_config, pyramid_request, version):
994
1001
),
995
1002
],
996
1003
)
997
- @pytest .mark .filterwarnings ("ignore:Creating a LegacyVersion.*:DeprecationWarning" )
998
1004
def test_fails_invalid_post_data (
999
1005
self , pyramid_config , db_request , post_data , message
1000
1006
):
0 commit comments