From 68f54a1a637242a7f6abfabf96f8e25df2a20f1a Mon Sep 17 00:00:00 2001 From: Daniel Grana Date: Mon, 27 Apr 2009 06:45:49 +0000 Subject: [PATCH] cookies: add test to check that wrapped cookiejar thread based lock is overrided --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%401086 --- scrapy/trunk/scrapy/tests/test_utils_cookies.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) +