diff --git a/scrapy/command/commands/genspider.py b/scrapy/command/commands/genspider.py index 048eec2b4..218adb67e 100644 --- a/scrapy/command/commands/genspider.py +++ b/scrapy/command/commands/genspider.py @@ -1,8 +1,8 @@ +import sys import shutil import string from os import listdir from os.path import join, dirname, abspath, exists -import sys import scrapy from scrapy.spider import spiders diff --git a/scrapy/command/commands/startproject.py b/scrapy/command/commands/startproject.py index 6b9664326..b30b91ce4 100644 --- a/scrapy/command/commands/startproject.py +++ b/scrapy/command/commands/startproject.py @@ -1,9 +1,9 @@ #!/usr/bin/env python +import sys import os import string import re -import sys import scrapy from scrapy.command import ScrapyCommand diff --git a/scrapy/tests/test_scrapy_ctl.py b/scrapy/tests/test_scrapy_ctl.py index f8177143b..db5360b42 100644 --- a/scrapy/tests/test_scrapy_ctl.py +++ b/scrapy/tests/test_scrapy_ctl.py @@ -1,16 +1,13 @@ -import os -from os.path import exists, join -import subprocess -from shutil import rmtree import sys +import os +import subprocess +from os.path import exists, join +from shutil import rmtree from tempfile import mkdtemp -from unittest import TestCase - -import scrapy -from scrapy.conf import settings +import unittest -class ProjectTest(TestCase): +class ProjectTest(unittest.TestCase): project_name = 'testproject' def setUp(self): @@ -25,7 +22,7 @@ class ProjectTest(TestCase): args = [sys.executable, '-m', 'scrapy.command.cmdline'] args.extend(new_args) - env = self.env if hasattr(self, 'env') else os.environ + env = getattr(self, 'env', os.environ) return subprocess.call(args, stdout=out, stderr=out, cwd=self.cwd, \ env=env, **kwargs) @@ -115,3 +112,5 @@ class CsvFeedGenspiderTest(BaseGenspiderTest): class XMLFeedGenspiderTest(BaseGenspiderTest): template = 'xmlfeed' +if __name__ == '__main__': + unittest.main()