1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-03-14 06:48:31 +00:00

chore(tests): Remove validations for unsupported modules versions

This commit is contained in:
Laerte Pereira 2022-06-09 09:08:09 -03:00
parent 2e6721fd86
commit 6770d1ec62
No known key found for this signature in database
GPG Key ID: BB69B5C731BB8A80
3 changed files with 1 additions and 44 deletions

View File

@ -1,13 +1,11 @@
import asyncio import asyncio
from unittest import mock, SkipTest from unittest import mock
from pytest import mark from pytest import mark
from twisted import version as twisted_version
from twisted.internet import defer from twisted.internet import defer
from twisted.internet.defer import Deferred from twisted.internet.defer import Deferred
from twisted.trial.unittest import TestCase from twisted.trial.unittest import TestCase
from twisted.python.failure import Failure from twisted.python.failure import Failure
from twisted.python.versions import Version
from scrapy.http import Request, Response from scrapy.http import Request, Response
from scrapy.spiders import Spider from scrapy.spiders import Spider
@ -218,16 +216,6 @@ class MiddlewareUsingCoro(ManagerTestCase):
"""Middlewares using asyncio coroutines should work""" """Middlewares using asyncio coroutines should work"""
def test_asyncdef(self): def test_asyncdef(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 '
'hangs when using AsyncIO and Twisted versions lower than '
'18.4.0'
)
resp = Response('http://example.com/index.html') resp = Response('http://example.com/index.html')
class CoroMiddleware: class CoroMiddleware:
@ -248,12 +236,6 @@ class MiddlewareUsingCoro(ManagerTestCase):
@mark.only_asyncio() @mark.only_asyncio()
def test_asyncdef_asyncio(self): def test_asyncdef_asyncio(self):
if twisted_version < Version('twisted', 18, 4, 0):
raise SkipTest(
'Due to https://twistedmatrix.com/trac/ticket/9390, this test '
'hangs when using Twisted versions lower than 18.4.0'
)
resp = Response('http://example.com/index.html') resp = Response('http://example.com/index.html')
class CoroMiddleware: class CoroMiddleware:

View File

@ -1,13 +1,10 @@
import asyncio import asyncio
from unittest import SkipTest
from pydispatch import dispatcher from pydispatch import dispatcher
from pytest import mark from pytest import mark
from testfixtures import LogCapture from testfixtures import LogCapture
from twisted import version as twisted_version
from twisted.internet import defer, reactor from twisted.internet import defer, reactor
from twisted.python.failure import Failure from twisted.python.failure import Failure
from twisted.python.versions import Version
from twisted.trial import unittest from twisted.trial import unittest
from scrapy.utils.signal import send_catch_log, send_catch_log_deferred from scrapy.utils.signal import send_catch_log, send_catch_log_deferred
@ -81,16 +78,6 @@ class SendCatchLogDeferredAsyncDefTest(SendCatchLogDeferredTest):
return "OK" return "OK"
def test_send_catch_log(self): 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() return super().test_send_catch_log()
@ -104,13 +91,6 @@ class SendCatchLogDeferredAsyncioTest(SendCatchLogDeferredTest):
return await get_from_asyncio_queue("OK") return await get_from_asyncio_queue("OK")
def test_send_catch_log(self): 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() return super().test_send_catch_log()

View File

@ -4,10 +4,7 @@ Tests borrowed from the twisted.web.client tests.
""" """
import os import os
import shutil import shutil
import sys
from pkg_resources import parse_version
import cryptography
import OpenSSL.SSL import OpenSSL.SSL
from twisted.trial import unittest from twisted.trial import unittest
from twisted.web import server, static, util, resource from twisted.web import server, static, util, resource
@ -417,8 +414,6 @@ class WebClientCustomCiphersSSLTestCase(WebClientSSLTestCase):
).addCallback(self.assertEqual, to_bytes(s)) ).addCallback(self.assertEqual, to_bytes(s))
def testPayloadDisabledCipher(self): def testPayloadDisabledCipher(self):
if sys.implementation.name == "pypy" and parse_version(cryptography.__version__) <= parse_version("2.3.1"):
self.skipTest("This test expects a failure, but the code does work in PyPy with cryptography<=2.3.1")
s = "0123456789" * 10 s = "0123456789" * 10
settings = Settings({'DOWNLOADER_CLIENT_TLS_CIPHERS': 'ECDHE-RSA-AES256-GCM-SHA384'}) settings = Settings({'DOWNLOADER_CLIENT_TLS_CIPHERS': 'ECDHE-RSA-AES256-GCM-SHA384'})
client_context_factory = create_instance(ScrapyClientContextFactory, settings=settings, crawler=None) client_context_factory = create_instance(ScrapyClientContextFactory, settings=settings, crawler=None)