diff --git a/test/test_anti_spam.py b/test/test_anti_spam.py index 8f67076..426e877 100644 --- a/test/test_anti_spam.py +++ b/test/test_anti_spam.py @@ -19,7 +19,7 @@ def set_test_timeout(request): @pytest.fixture def clear_store(): - AntiSpam.clear() + AntiSpam.tweet_store = {} AntiSpam.timeout = 600 diff --git a/test/test_format.py b/test/test_format.py index bd385eb..5e54bbd 100644 --- a/test/test_format.py +++ b/test/test_format.py @@ -4,43 +4,35 @@ from __future__ import unicode_literals -import os import sys import json import pytest -if sys.version_info > (3,): - from io import StringIO -else: - from StringIO import StringIO - from pyweet.spam import AntiSpam from pyweet.base import print_tweet, parse_date, parse_args -STDOUT = None - - @pytest.fixture def settings(): - return parse_args() + _settings = parse_args() + _settings.update({"spam": True}) + return _settings @pytest.fixture(autouse=True) def test_setup(request): """Register the finalizer.""" + AntiSpam.tweet_store = {} request.addfinalizer(test_teardown) -@pytest.fixture def test_teardown(): """Reset argv and clear the AntiSpam.""" while len(sys.argv) > 1: sys.argv.pop(-1) - AntiSpam.tweet_store = {} def test_basic_tweet_parsing(tweet, settings, capfd): @@ -97,6 +89,7 @@ def test_parsing_with_time_and_date(tweet, settings, capfd): def test_second_parse_is_spam(tweet, settings, capfd): """The second identical tweet should be caught and not printed.""" + settings.update({"spam": False}) print_tweet(tweet, settings) out, _ = capfd.readouterr() assert (