Merge pull request #75 from darkrho/httpcache-stats

tests: fixed httpcache testcase.
This commit is contained in:
Pablo Hoffman 2012-01-01 09:30:31 -08:00
commit 1f87d7ff4b
1 changed files with 3 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import unittest, tempfile, shutil, time
from scrapy.http import Response, HtmlResponse, Request
from scrapy.spider import BaseSpider
from scrapy.contrib.downloadermiddleware.httpcache import FilesystemCacheStorage, HttpCacheMiddleware
from scrapy.stats import stats
from scrapy.settings import Settings
from scrapy.exceptions import IgnoreRequest
@ -16,8 +17,10 @@ class HttpCacheMiddlewareTest(unittest.TestCase):
self.tmpdir = tempfile.mkdtemp()
self.request = Request('http://www.example.com', headers={'User-Agent': 'test'})
self.response = Response('http://www.example.com', headers={'Content-Type': 'text/html'}, body='test body', status=202)
stats.open_spider(self.spider)
def tearDown(self):
stats.close_spider(self.spider, '')
shutil.rmtree(self.tmpdir)
def _get_settings(self, **new_settings):