Scrapy, a fast high-level web crawling & scraping framework for Python.
test inspect.stack failure
Daniel Graña9e95b36a0975
diff --git a/scrapy/tests/test_utils_deprecate.py b/scrapy/tests/test_utils_deprecate.pyindex 07b9a3dd5..dfecc6d2a 100644--- a/scrapy/tests/test_utils_deprecate.py+++ b/scrapy/tests/test_utils_deprecate.py@@ -3,14 +3,18 @@ from __future__ import absolute_importimport inspectimport unittestimport warnings+import mockfrom scrapy.utils.deprecate import create_deprecated_class+class MyWarning(UserWarning):pass+class SomeBaseClass(object):pass+class NewName(SomeBaseClass):pass@@ -223,3 +227,12 @@ class WarnWhenSubclassedTest(unittest.TestCase):self.assertIn('foo.Bar', str(w[0].message))self.assertIn('AlsoDeprecated', str(w[1].message))self.assertIn('foo.Bar', str(w[1].message))++ def test_inspect_stack(self):+ with mock.patch('inspect.stack', side_effect=IndexError):+ with warnings.catch_warnings(record=True) as w:+ DeprecatedName = create_deprecated_class('DeprecatedName', NewName)+ class SubClass(DeprecatedName):+ pass++ self.assertIn("Error detecting parent module", str(w[0].message))