Scrapy, a fast high-level web crawling & scraping framework for Python.
Make scrapyd.eggutils compatible with Python 2.5 and added tests for get_spider_list_from_eggfile() function (closes #242)
Pablo Hoffman400c4134af7d
diff --git a/scrapyd/eggutils.py b/scrapyd/eggutils.pyindex 1e1975580..c507f0be5 100644--- a/scrapyd/eggutils.py+++ b/scrapyd/eggutils.py@@ -1,3 +1,5 @@+from __future__ import with_statement+import os, sys, shutil, pkg_resourcesfrom subprocess import Popen, PIPEfrom tempfile import NamedTemporaryFile, mkdtempdiff --git a/scrapyd/tests/mybot.egg b/scrapyd/tests/mybot.eggnew file mode 100644index 000000000..8525589bbBinary files /dev/null and b/scrapyd/tests/mybot.egg differdiff --git a/scrapyd/tests/test_eggutils.py b/scrapyd/tests/test_eggutils.pynew file mode 100644index 000000000..ec6d00269--- /dev/null+++ b/scrapyd/tests/test_eggutils.py@@ -0,0 +1,11 @@+import pkgutil, unittest+from cStringIO import StringIO++from scrapyd.eggutils import get_spider_list_from_eggfile++class EggUtilsTest(unittest.TestCase):++ def test_get_spider_list_from_eggfile(self):+ eggfile = StringIO(pkgutil.get_data(__package__, 'mybot.egg'))+ spiders = get_spider_list_from_eggfile(eggfile, 'mybot')+ self.assertEqual(set(spiders), set(['spider1', 'spider2']))