From d8ac4857a50064476713270d10b2ea0098fb85a6 Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Mon, 14 Jun 2010 09:11:35 -0300 Subject: [PATCH] a couple of fixes to make tests pass on win32 --- scrapy/tests/test_utils_response.py | 6 +++++- scrapy/utils/jsonrpc.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scrapy/tests/test_utils_response.py b/scrapy/tests/test_utils_response.py index 71c14569e..606ed4ee4 100644 --- a/scrapy/tests/test_utils_response.py +++ b/scrapy/tests/test_utils_response.py @@ -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 = " test page test body " 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 '' % url in bbody, " tag not added" return True response = HtmlResponse(url, body=body) diff --git a/scrapy/utils/jsonrpc.py b/scrapy/utils/jsonrpc.py index 6735e7a03..d9d4008c9 100644 --- a/scrapy/utils/jsonrpc.py +++ b/scrapy/utils/jsonrpc.py @@ -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: