Merge pull request #367 from carpedm20/fix-pytest-deprecation
Fix pytest "Applying marks directly to parameters" deprecation
This commit is contained in:
@@ -20,7 +20,9 @@ def group(pytestconfig):
|
||||
return {"id": load_variable("group_id", pytestconfig.cache), "type": ThreadType.GROUP}
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", params=["user", "group", pytest.mark.xfail("none")])
|
||||
@pytest.fixture(scope="session", params=[
|
||||
"user", "group", pytest.param("none", marks=[pytest.mark.xfail()])
|
||||
])
|
||||
def thread(request, user, group):
|
||||
return {
|
||||
"user": user,
|
||||
|
@@ -11,8 +11,14 @@ from time import time
|
||||
|
||||
@pytest.fixture(scope="module", params=[
|
||||
Plan(int(time()) + 100, random_hex()),
|
||||
pytest.mark.xfail(Plan(int(time()), random_hex()), raises=FBchatFacebookError),
|
||||
pytest.mark.xfail(Plan(0, None)),
|
||||
pytest.param(
|
||||
Plan(int(time()), random_hex()),
|
||||
marks=[pytest.mark.xfail(raises=FBchatFacebookError)]
|
||||
),
|
||||
pytest.param(
|
||||
Plan(0, None),
|
||||
marks=[pytest.mark.xfail()],
|
||||
),
|
||||
])
|
||||
def plan_data(request, client, user, thread, catch_event, compare):
|
||||
with catch_event("onPlanCreated") as x:
|
||||
|
@@ -26,7 +26,9 @@ from utils import random_hex, subset
|
||||
PollOption(random_hex()),
|
||||
PollOption(random_hex()),
|
||||
]),
|
||||
pytest.mark.xfail(Poll(title=None, options=[]), raises=ValueError),
|
||||
pytest.param(
|
||||
Poll(title=None, options=[]), marks=[pytest.mark.xfail(raises=ValueError)]
|
||||
),
|
||||
])
|
||||
def poll_data(request, client1, group, catch_event):
|
||||
with catch_event("onPollCreated") as x:
|
||||
|
@@ -72,8 +72,8 @@ def test_change_nickname(client, client_all, catch_event, compare):
|
||||
"😂",
|
||||
"😕",
|
||||
"😍",
|
||||
pytest.mark.xfail("🙃", raises=FBchatFacebookError),
|
||||
pytest.mark.xfail("not an emoji", raises=FBchatFacebookError)
|
||||
pytest.param("🙃", marks=[pytest.mark.xfail(raises=FBchatFacebookError)]),
|
||||
pytest.param("not an emoji", marks=[pytest.mark.xfail(raises=FBchatFacebookError)]),
|
||||
])
|
||||
def test_change_emoji(client, catch_event, compare, emoji):
|
||||
with catch_event("onEmojiChange") as x:
|
||||
@@ -101,7 +101,7 @@ def test_change_image_remote(client1, group, catch_event):
|
||||
[
|
||||
x
|
||||
if x in [ThreadColor.MESSENGER_BLUE, ThreadColor.PUMPKIN]
|
||||
else pytest.mark.expensive(x)
|
||||
else pytest.param(x, marks=[pytest.mark.expensive()])
|
||||
for x in ThreadColor
|
||||
],
|
||||
)
|
||||
|
@@ -23,15 +23,15 @@ EMOJI_LIST = [
|
||||
("😆", EmojiSize.LARGE),
|
||||
# These fail in `catch_event` because the emoji is made into a sticker
|
||||
# This should be fixed
|
||||
pytest.mark.xfail((None, EmojiSize.SMALL)),
|
||||
pytest.mark.xfail((None, EmojiSize.MEDIUM)),
|
||||
pytest.mark.xfail((None, EmojiSize.LARGE)),
|
||||
pytest.param(None, EmojiSize.SMALL, marks=[pytest.mark.xfail()]),
|
||||
pytest.param(None, EmojiSize.MEDIUM, marks=[pytest.mark.xfail()]),
|
||||
pytest.param(None, EmojiSize.LARGE, marks=[pytest.mark.xfail()]),
|
||||
]
|
||||
|
||||
STICKER_LIST = [
|
||||
Sticker("767334476626295"),
|
||||
pytest.mark.xfail(Sticker("0"), raises=FBchatFacebookError),
|
||||
pytest.mark.xfail(Sticker(None), raises=FBchatFacebookError),
|
||||
pytest.param(Sticker("0"), marks=[pytest.mark.xfail(raises=FBchatFacebookError)]),
|
||||
pytest.param(Sticker(None), marks=[pytest.mark.xfail(raises=FBchatFacebookError)]),
|
||||
]
|
||||
|
||||
TEXT_LIST = [
|
||||
@@ -40,8 +40,8 @@ TEXT_LIST = [
|
||||
"\\\n\t%?&'\"",
|
||||
"ˁҭʚ¹Ʋջوװ՞ޱɣࠚԹБɑȑңКએ֭ʗыԈٌʼőԈ×௴nચϚࠖణٔє܅Ԇޑط",
|
||||
"a" * 20000, # Maximum amount of characters you can send
|
||||
pytest.mark.xfail("a" * 20001, raises=FBchatFacebookError),
|
||||
pytest.mark.xfail(None, raises=FBchatFacebookError),
|
||||
pytest.param("a" * 20001, marks=[pytest.mark.xfail(raises=FBchatFacebookError)]),
|
||||
pytest.param(None, marks=[pytest.mark.xfail(raises=FBchatFacebookError)]),
|
||||
]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user