mirror of https://github.com/scrapy/scrapy.git
Do not warn about internal usage of ResponseTypes.CLASSES
This commit is contained in:
parent
54a0248301
commit
55105ddc7c
|
|
@ -56,7 +56,10 @@ class ResponseTypes(metaclass=_ResponseTypesMeta):
|
|||
def __init__(self):
|
||||
self.classes = {}
|
||||
self.mimetypes = _MIME_TYPES
|
||||
for mimetype, cls in self.CLASSES.items():
|
||||
with catch_warnings():
|
||||
simplefilter("ignore")
|
||||
classes_items = self.CLASSES.items()
|
||||
for mimetype, cls in classes_items:
|
||||
self.classes[mimetype] = load_object(cls)
|
||||
|
||||
def __getattribute__(self, name):
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ class ResponseTypesTest(unittest.TestCase):
|
|||
)
|
||||
messages = {str(warning.message) for warning in warnings}
|
||||
self.assertIn(expected_message, messages)
|
||||
unxepected_message = (
|
||||
'scrapy.responsetypes.ResponseTypes.CLASSES is deprecated'
|
||||
)
|
||||
self.assertNotIn(unxepected_message, messages)
|
||||
|
||||
def test_class_classes_deprecation(self):
|
||||
with catch_warnings(record=True) as warnings:
|
||||
|
|
|
|||
Loading…
Reference in New Issue