Scrapy, a fast high-level web crawling & scraping framework for Python.
Skip 2 additional tests with older Twisted versions
Adrián Chaves1941f607ca54
diff --git a/tests/test_utils_signal.py b/tests/test_utils_signal.pyindex b66588efb..18a8fb49c 100644--- a/tests/test_utils_signal.py+++ b/tests/test_utils_signal.py@@ -1,11 +1,14 @@import asyncio+from unittest import SkipTest+from pydispatch import dispatcherfrom pytest import markfrom testfixtures import LogCapture-from twisted.trial import unittest-from twisted.python.failure import Failure+from twisted import version as twisted_versionfrom twisted.internet import defer, reactor-from pydispatch import dispatcher+from twisted.python.failure import Failure+from twisted.python.versions import Version+from twisted.trial import unittestfrom scrapy.utils.signal import send_catch_log, send_catch_log_deferredfrom scrapy.utils.test import get_from_asyncio_queue@@ -68,6 +71,7 @@ class SendCatchLogDeferredTest2(SendCatchLogDeferredTest):return d[email protected]('reactor_pytest')class SendCatchLogDeferredAsyncDefTest(SendCatchLogDeferredTest):async def ok_handler(self, arg, handlers_called):@@ -76,6 +80,19 @@ class SendCatchLogDeferredAsyncDefTest(SendCatchLogDeferredTest):await defer.succeed(42)return "OK"+ def test_send_catch_log(self):+ if (+ self.reactor_pytest == 'asyncio'+ and twisted_version < Version('twisted', 18, 4, 0)+ ):+ raise SkipTest(+ 'Due to https://twistedmatrix.com/trac/ticket/9390, this test '+ 'fails due to a timeout when using AsyncIO and Twisted '+ 'versions lower than 18.4.0'+ )++ return super().test_send_catch_log()+@mark.only_asyncio()class SendCatchLogDeferredAsyncioTest(SendCatchLogDeferredTest):@@ -86,6 +103,16 @@ class SendCatchLogDeferredAsyncioTest(SendCatchLogDeferredTest):await asyncio.sleep(0.2)return await get_from_asyncio_queue("OK")+ def test_send_catch_log(self):+ if (twisted_version < Version('twisted', 18, 4, 0):+ raise SkipTest(+ 'Due to https://twistedmatrix.com/trac/ticket/9390, this test '+ 'fails due to a timeout when using Twisted versions lower '+ 'than 18.4.0'+ )++ return super().test_send_catch_log()+class SendCatchLogTest2(unittest.TestCase):