Mark existing tests as online

- Remove `offline` and `expensive` markers
This commit is contained in:
Mads Marquart
2019-09-08 23:27:06 +02:00
parent 7416c8b7fc
commit d06ff7078a
11 changed files with 24 additions and 13 deletions

View File

@@ -7,7 +7,7 @@ cache: pip
before_install: pip install flit
# Use `--deps production` so that we don't install unnecessary dependencies
install: flit install --deps production --extras test
script: pytest -m offline
script: pytest
jobs:
include:

View File

@@ -1,10 +1,9 @@
[pytest]
xfail_strict = true
markers =
offline: Offline tests, aka. tests that can be executed without the need of a client
expensive: Expensive tests, which should be executed sparingly
online: Online tests, aka. disabled tests...
addopts =
--strict-markers
-m "not expensive"
-m "not online"
testpaths = tests
filterwarnings = error

View File

@@ -6,7 +6,6 @@ from os import path, environ
from fbchat import FBchatException, Message, Client
@pytest.mark.offline
def test_examples():
# Compiles the examples, to check for syntax errors
for name in glob(path.join(path.dirname(__file__), "../examples", "*.py")):
@@ -14,7 +13,7 @@ def test_examples():
@pytest.mark.trylast
@pytest.mark.expensive
@pytest.mark.online
def test_login(client1):
assert client1.is_logged_in()
email = client1.email
@@ -33,6 +32,7 @@ def test_login(client1):
@pytest.mark.trylast
@pytest.mark.online
def test_sessions(client1):
session = client1.get_session()
Client("no email needed", "no password needed", session_cookies=session)

View File

@@ -4,6 +4,8 @@ from os import path
from fbchat import ThreadType, Message, Mention, EmojiSize, Sticker
from utils import subset, STICKER_LIST, EMOJI_LIST
pytestmark = pytest.mark.online
def test_fetch_all_users(client1):
users = client1.fetch_all_users()

View File

@@ -3,6 +3,8 @@ import pytest
from fbchat import Message, MessageReaction
from utils import subset
pytestmark = pytest.mark.online
def test_set_reaction(client):
mid = client.send(Message(text="This message will be reacted to"))

View File

@@ -4,6 +4,8 @@ from fbchat import Plan, FBchatFacebookError, ThreadType
from utils import random_hex, subset
from time import time
pytestmark = pytest.mark.online
@pytest.fixture(
scope="module",
@@ -84,7 +86,7 @@ def test_edit_plan(client, thread, catch_event, compare, plan_data):
@pytest.mark.trylast
@pytest.mark.expensive
@pytest.mark.skip
def test_on_plan_ended(client, thread, catch_event, compare):
with catch_event("on_plan_ended") as x:
client.create_plan(Plan(int(time()) + 120, "Wait for ending"))

View File

@@ -3,6 +3,8 @@ import pytest
from fbchat import Poll, PollOption, ThreadType
from utils import random_hex, subset
pytestmark = pytest.mark.online
@pytest.fixture(
scope="module",

View File

@@ -1,5 +1,8 @@
import pytest
from fbchat import ThreadType
pytestmark = pytest.mark.online
def test_search_for(client1):
users = client1.search_for_users("Mark Zuckerberg")

View File

@@ -4,6 +4,8 @@ from os import path
from fbchat import FBchatFacebookError, Message, Mention
from utils import subset, STICKER_LIST, EMOJI_LIST, TEXT_LIST
pytestmark = pytest.mark.online
@pytest.mark.parametrize("text", TEXT_LIST)
def test_send_text(client, catch_event, compare, text):

View File

@@ -1,5 +1,7 @@
import pytest
pytestmark = pytest.mark.online
def test_catch_event(client2, catch_event):
mid = "test"

View File

@@ -4,6 +4,8 @@ from fbchat import Message, ThreadType, FBchatFacebookError, TypingStatus, Threa
from utils import random_hex, subset
from os import path
pytestmark = pytest.mark.online
def test_remove_from_and_add_to_group(client1, client2, group, catch_event):
# Test both methods, while ensuring that the user gets added to the group
@@ -97,12 +99,7 @@ def test_change_image_remote(client1, group, catch_event):
@pytest.mark.parametrize(
"color",
[
x
if x in [ThreadColor.MESSENGER_BLUE, ThreadColor.PUMPKIN]
else pytest.param(x, marks=[pytest.mark.expensive()])
for x in ThreadColor
],
[x for x in ThreadColor if x in [ThreadColor.MESSENGER_BLUE, ThreadColor.PUMPKIN]],
)
def test_change_color(client, catch_event, compare, color):
with catch_event("on_color_change") as x: