From 359129adf9d661ed1a58f7dec0b7afb02817a31e Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Thu, 14 Jul 2011 01:40:31 -0300 Subject: [PATCH] fixed python pass handling in cmdline/commands tests so that it works with new w3lib library --- scrapy/tests/test_cmdline/__init__.py | 5 ++--- scrapy/tests/test_commands.py | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scrapy/tests/test_cmdline/__init__.py b/scrapy/tests/test_cmdline/__init__.py index d08f266f1..2fb08e119 100644 --- a/scrapy/tests/test_cmdline/__init__.py +++ b/scrapy/tests/test_cmdline/__init__.py @@ -3,13 +3,12 @@ import os from subprocess import Popen, PIPE import unittest -import scrapy - class CmdlineTest(unittest.TestCase): def setUp(self): self.env = os.environ.copy() - self.env['PYTHONPATH'] = os.path.dirname(scrapy.__path__[0]) + if 'PYTHONPATH' in os.environ: + self.env['PYTHONPATH'] = os.environ['PYTHONPATH'] self.env['SCRAPY_SETTINGS_MODULE'] = 'scrapy.tests.test_cmdline.settings' def _execute(self, *new_args, **kwargs): diff --git a/scrapy/tests/test_commands.py b/scrapy/tests/test_commands.py index e2b671d19..170030693 100644 --- a/scrapy/tests/test_commands.py +++ b/scrapy/tests/test_commands.py @@ -3,14 +3,12 @@ from __future__ import with_statement import sys import os import subprocess -from os.path import exists, join, dirname, abspath +from os.path import exists, join, abspath from shutil import rmtree from tempfile import mkdtemp from twisted.trial import unittest -import scrapy - class ProjectTest(unittest.TestCase): project_name = 'testproject' @@ -21,7 +19,8 @@ class ProjectTest(unittest.TestCase): self.proj_path = join(self.temp_path, self.project_name) self.proj_mod_path = join(self.proj_path, self.project_name) self.env = os.environ.copy() - self.env['PYTHONPATH'] = dirname(scrapy.__path__[0]) + if 'PYTHONPATH' in os.environ: + self.env['PYTHONPATH'] = os.environ['PYTHONPATH'] def tearDown(self): rmtree(self.temp_path)