Skip to content

Commit 7bbbaa3

Browse files
committed
Test the feature_flag argument in deprecated helper
This wasn't covered properly in the PR that introduced this.
1 parent 7120590 commit 7bbbaa3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/unit/test_utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,16 @@ def patch_deprecation_check_version():
879879
@pytest.mark.parametrize("replacement", [None, "a magic 8 ball"])
880880
@pytest.mark.parametrize("gone_in", [None, "2.0"])
881881
@pytest.mark.parametrize("issue", [None, 988])
882-
def test_deprecated_message_contains_information(gone_in, replacement, issue):
882+
@pytest.mark.parametrize("feature_flag", [None, "magic-8-ball"])
883+
def test_deprecated_message_contains_information(
884+
gone_in, replacement, issue, feature_flag
885+
):
883886
with pytest.warns(PipDeprecationWarning) as record:
884887
deprecated(
885888
reason="Stop doing this!",
886889
replacement=replacement,
887890
gone_in=gone_in,
891+
feature_flag=feature_flag,
888892
issue=issue,
889893
)
890894

@@ -893,20 +897,22 @@ def test_deprecated_message_contains_information(gone_in, replacement, issue):
893897

894898
assert "DEPRECATION: Stop doing this!" in message
895899
# Ensure non-None values are mentioned.
896-
for item in [gone_in, replacement, issue]:
900+
for item in [gone_in, replacement, issue, feature_flag]:
897901
if item is not None:
898902
assert str(item) in message
899903

900904

901905
@pytest.mark.usefixtures("patch_deprecation_check_version")
902906
@pytest.mark.parametrize("replacement", [None, "a magic 8 ball"])
903907
@pytest.mark.parametrize("issue", [None, 988])
904-
def test_deprecated_raises_error_if_too_old(replacement, issue):
908+
@pytest.mark.parametrize("feature_flag", [None, "magic-8-ball"])
909+
def test_deprecated_raises_error_if_too_old(replacement, issue, feature_flag):
905910
with pytest.raises(PipDeprecationWarning) as exception:
906911
deprecated(
907912
reason="Stop doing this!",
908913
gone_in="1.0", # this matches the patched version.
909914
replacement=replacement,
915+
feature_flag=feature_flag,
910916
issue=issue,
911917
)
912918

@@ -915,7 +921,7 @@ def test_deprecated_raises_error_if_too_old(replacement, issue):
915921
assert "DEPRECATION: Stop doing this!" in message
916922
assert "1.0" in message
917923
# Ensure non-None values are mentioned.
918-
for item in [replacement, issue]:
924+
for item in [replacement, issue, feature_flag]:
919925
if item is not None:
920926
assert str(item) in message
921927

0 commit comments

Comments
 (0)