From 6e028fd91b8e039c2f4b60cb98f23eab78f983fe Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Sat, 29 Aug 2009 04:59:51 -0300 Subject: [PATCH] fixed JsonLinesItemExporterTest --- scrapy/tests/test_contrib_exporter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scrapy/tests/test_contrib_exporter.py b/scrapy/tests/test_contrib_exporter.py index 6a7383d96..d5cd1765f 100644 --- a/scrapy/tests/test_contrib_exporter.py +++ b/scrapy/tests/test_contrib_exporter.py @@ -122,7 +122,7 @@ class XmlItemExporterTest(BaseItemExporterTest): class JsonLinesItemExporterTest(BaseItemExporterTest): - def _get_exporter(self, **kwargs): + def setUp(self): try: import json except ImportError: @@ -130,12 +130,15 @@ class JsonLinesItemExporterTest(BaseItemExporterTest): import simplejson except ImportError: raise unittest.SkipTest("simplejson module not available") + super(JsonLinesItemExporterTest, self).setUp() + + def _get_exporter(self, **kwargs): from scrapy.contrib.exporter.jsonlines import JsonLinesItemExporter return JsonLinesItemExporter(self.output, **kwargs) def _check_output(self): - import simplejson - exported = simplejson.loads(self.output.getvalue().strip()) + from scrapy.contrib.exporter.jsonlines import json + exported = json.loads(self.output.getvalue().strip()) self.assertEqual(exported, dict(self.i))