Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

cookies: add test to check that wrapped cookiejar thread based lock is overrided

Daniel Grana68f54a1a6372
diff --git a/scrapy/trunk/scrapy/tests/test_utils_cookies.py b/scrapy/trunk/scrapy/tests/test_utils_cookies.py
index e843749a6..d8b1cfb5d 100644
--- a/scrapy/trunk/scrapy/tests/test_utils_cookies.py
+++ b/scrapy/trunk/scrapy/tests/test_utils_cookies.py
@@ -1100,7 +1100,7 @@ class LWPCookieTests(TestCase):
'PART_NUMBER=ROCKET_LAUNCHER_0001; NO_A_BOT; GOOD_CUSTOMER')
-class WrapperRequestResponse(TestCase):
+class CookielibWrappersTest(TestCase):
def FakeRequest(self, url, data='', headers={}):
tail = '?' + urllib.quote(data) if data else ''
@@ -1147,4 +1147,13 @@ class WrapperRequestResponse(TestCase):
req = self.FakeRequest("http://www.acme.com:2345/resource.html", headers={"Host": "www.acme.com:5432"})
self.assertEquals(request_host(req), "www.acme.com")
+ def test_threadlock_override(self):
+ try:
+ import threading as _threading
+ except ImportError:
+ import dummy_threading as _threading
+
+ c = CookieJar()
+ assert not isinstance(c.jar._cookies_lock, _threading._RLock)
+