add deprecation for pydispatch (thanks for the help @redapple)

This commit is contained in:
Elias Dorneles 2016-02-06 00:08:59 -02:00
parent e328a9b9df
commit 164493df2e
3 changed files with 34 additions and 0 deletions

View File

@ -124,6 +124,9 @@ Deprecations and Removals
+ ``scrapy.utils.datatypes.MultiValueDict``
+ ``scrapy.utils.datatypes.SiteNode``
- The previously bundled ``scrapy.xlib.pydispatch`` library was deprecated and
replaced by `pydispatcher <https://pypi.python.org/pypi/PyDispatcher>`_.
Relocations
~~~~~~~~~~~

19
scrapy/xlib/pydispatch.py Normal file
View File

@ -0,0 +1,19 @@
from __future__ import absolute_import
import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
from pydispatch import (
dispatcher,
errors,
robust,
robustapply,
saferef,
)
warnings.warn("Importing from scrapy.xlib.pydispatch is deprecated and will"
" no longer be supported in future Scrapy versions."
" If you just want to connect signals use the from_crawler class method,"
" otherwise import pydispatch directly if needed."
" See: https://github.com/scrapy/scrapy/issues/1762",
ScrapyDeprecationWarning, stacklevel=2)

View File

@ -0,0 +1,12 @@
import unittest
import warnings
from six.moves import reload_module
class DeprecatedPydispatchTest(unittest.TestCase):
def test_import_xlib_pydispatch_show_warning(self):
with warnings.catch_warnings(record=True) as w:
from scrapy.xlib import pydispatch
reload_module(pydispatch)
self.assertIn('Importing from scrapy.xlib.pydispatch is deprecated',
str(w[0].message))