mirror of https://github.com/scrapy/scrapy.git
Skip MiddlewareUsingCoro::test_asyncdef on asyncio and old Twisted
This commit is contained in:
parent
8e7b756727
commit
906626cf0b
|
|
@ -1,11 +1,12 @@
|
|||
import asyncio
|
||||
from unittest import mock
|
||||
from unittest import mock, SkipTest
|
||||
|
||||
from pytest import mark
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.defer import Deferred
|
||||
from twisted.trial.unittest import TestCase
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.python.versions import Version
|
||||
|
||||
from scrapy.http import Request, Response
|
||||
from scrapy.spiders import Spider
|
||||
|
|
@ -211,10 +212,24 @@ class MiddlewareUsingDeferreds(ManagerTestCase):
|
|||
self.assertFalse(download_func.called)
|
||||
|
||||
|
||||
@mark.usefixtures('reactor_pytest')
|
||||
class MiddlewareUsingCoro(ManagerTestCase):
|
||||
"""Middlewares using asyncio coroutines should work"""
|
||||
|
||||
def test_asyncdef(self):
|
||||
import twisted
|
||||
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 '
|
||||
'hangs when using AsyncIO and Twisted versions lower than '
|
||||
'18.4.0'
|
||||
)
|
||||
|
||||
from twisted.python.versions import Version
|
||||
|
||||
resp = Response('http://example.com/index.html')
|
||||
|
||||
class CoroMiddleware:
|
||||
|
|
|
|||
Loading…
Reference in New Issue