Make scrapyd.eggutils compatible with Python 2.5 and added tests for get_spider_list_from_eggfile() function (closes #242)

This commit is contained in:
Pablo Hoffman 2010-09-19 21:08:27 -03:00
parent aa86f180b9
commit 400c4134af
3 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,5 @@
from __future__ import with_statement
import os, sys, shutil, pkg_resources
from subprocess import Popen, PIPE
from tempfile import NamedTemporaryFile, mkdtemp

BIN
scrapyd/tests/mybot.egg Normal file

Binary file not shown.

View File

@ -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']))