Scrapy, a fast high-level web crawling & scraping framework for Python.
Use binary flag in read/write operations, to fix tests in windows
Martin Olveyraa99bb0de9bda
diff --git a/scrapy/tests/test_contrib_ibl/test_htmlpage.py b/scrapy/tests/test_contrib_ibl/test_htmlpage.pyindex a4778b9b5..cdba56853 100644--- a/scrapy/tests/test_contrib_ibl/test_htmlpage.py+++ b/scrapy/tests/test_contrib_ibl/test_htmlpage.py@@ -43,9 +43,9 @@ def add_sample(source):while os.path.exists("%s_%d.json" % (SAMPLES_FILE_PREFIX, count)):count += 1- open("%s_%d.html" % (SAMPLES_FILE_PREFIX, count), "w").write(unicode_to_str(source))+ open("%s_%d.html" % (SAMPLES_FILE_PREFIX, count), "wb").write(unicode_to_str(source))parsed = list(parse_html(source))- open("%s_%d.json" % (SAMPLES_FILE_PREFIX, count), "w")\+ open("%s_%d.json" % (SAMPLES_FILE_PREFIX, count), "wb")\.write(json.dumps(parsed, default=_encode_element, indent=8))class TestParseHtml(TestCase):@@ -96,8 +96,8 @@ class TestParseHtml(TestCase):count = 0fname = "%s_%d.json" % (SAMPLES_FILE_PREFIX, count)while os.path.exists(fname):- source = str_to_unicode(open("%s_%d.html" % (SAMPLES_FILE_PREFIX, count), "r").read())- parsed = json.loads(str_to_unicode(open(fname, "r").read()),\+ source = str_to_unicode(open("%s_%d.html" % (SAMPLES_FILE_PREFIX, count), "rb").read())+ parsed = json.loads(str_to_unicode(open(fname, "rb").read()),\object_hook=_decode_element)self._test_sample(source, parsed, count)count += 1diff --git a/scrapy/tests/test_contrib_ibl/test_pageparsing.py b/scrapy/tests/test_contrib_ibl/test_pageparsing.pyindex 1766f4aa2..ae5e1c129 100644--- a/scrapy/tests/test_contrib_ibl/test_pageparsing.py+++ b/scrapy/tests/test_contrib_ibl/test_pageparsing.py@@ -277,8 +277,8 @@ class TestPageParsing(TestCase):count = 0fname = "%s_%d.json" % (SAMPLES_FILE_PREFIX, count)while os.path.exists(fname):- source = str_to_unicode(open("%s_%d.html" % (SAMPLES_FILE_PREFIX, count), "r").read())- annotations = json.loads(str_to_unicode(open(fname, "r").read()))+ source = str_to_unicode(open("%s_%d.html" % (SAMPLES_FILE_PREFIX, count), "rb").read())+ annotations = json.loads(str_to_unicode(open(fname, "rb").read()))template = HtmlPage(body=source)parser = TemplatePageParser(TokenDict())parser.feed(template)