mirror of https://github.com/scrapy/scrapy.git
a couple of fixes to make tests pass on win32
This commit is contained in:
parent
2d3d5b6aba
commit
d8ac4857a5
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import unittest
|
||||
import urlparse
|
||||
|
||||
|
|
@ -147,7 +148,10 @@ class ResponseUtilsTest(unittest.TestCase):
|
|||
url = "http:///www.example.com/some/page.html"
|
||||
body = "<html> <head> <title>test page</title> </head> <body>test body</body> </html>"
|
||||
def browser_open(burl):
|
||||
bbody = open(urlparse.urlparse(burl).path).read()
|
||||
path = urlparse.urlparse(burl).path
|
||||
if not os.path.exists(path):
|
||||
path = burl.replace('file://', '')
|
||||
bbody = open(path).read()
|
||||
assert '<base href="%s">' % url in bbody, "<base> tag not added"
|
||||
return True
|
||||
response = HtmlResponse(url, body=body)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ def jsonrpc_server_call(target, jsonrpc_request, json_decoder=None):
|
|||
|
||||
params = req.get('params', [])
|
||||
a, kw = ([], params) if isinstance(params, dict) else (params, {})
|
||||
kw = dict([(str(k), v) for k, v in kw.items()]) # convert kw keys to str
|
||||
try:
|
||||
return jsonrpc_result(id, method(*a, **kw))
|
||||
except Exception, e:
|
||||
|
|
|
|||
Loading…
Reference in New Issue