@@ -920,20 +920,22 @@ def test_deprecated_raises_error_if_too_old(replacement, issue, feature_flag):
920
920
921
921
assert "DEPRECATION: Stop doing this!" in message
922
922
assert "1.0" in message
923
+ assert str (feature_flag ) not in message
923
924
# Ensure non-None values are mentioned.
924
- for item in [replacement , issue , feature_flag ]:
925
+ for item in [replacement , issue ]:
925
926
if item is not None :
926
927
assert str (item ) in message
927
928
928
929
929
930
@pytest .mark .usefixtures ("patch_deprecation_check_version" )
930
- def test_deprecated_message_reads_well ():
931
+ def test_deprecated_message_reads_well_past ():
931
932
with pytest .raises (PipDeprecationWarning ) as exception :
932
933
deprecated (
933
934
reason = "Stop doing this!" ,
934
935
gone_in = "1.0" , # this matches the patched version.
935
936
replacement = "to be nicer" ,
936
- issue = "100000" , # I hope we never reach this number.
937
+ feature_flag = "magic-8-ball" ,
938
+ issue = "100000" ,
937
939
)
938
940
939
941
message = exception .value .args [0 ]
@@ -946,6 +948,29 @@ def test_deprecated_message_reads_well():
946
948
)
947
949
948
950
951
+ @pytest .mark .usefixtures ("patch_deprecation_check_version" )
952
+ def test_deprecated_message_reads_well_future ():
953
+ with pytest .warns (PipDeprecationWarning ) as record :
954
+ deprecated (
955
+ reason = "Stop doing this!" ,
956
+ gone_in = "2.0" , # this is greater than the patched version.
957
+ replacement = "to be nicer" ,
958
+ feature_flag = "crisis" ,
959
+ issue = "100000" ,
960
+ )
961
+
962
+ assert len (record ) == 1
963
+ message = record [0 ].message .args [0 ]
964
+
965
+ assert message == (
966
+ "DEPRECATION: Stop doing this! "
967
+ "pip 2.0 will enforce this behaviour change. "
968
+ "A possible replacement is to be nicer. "
969
+ "You can use the flag --use-feature=crisis to test the upcoming behaviour. "
970
+ "Discussion can be found at https://github.com/pypa/pip/issues/100000"
971
+ )
972
+
973
+
949
974
def test_make_setuptools_shim_args ():
950
975
# Test all arguments at once, including the overall ordering.
951
976
args = make_setuptools_shim_args (
0 commit comments