Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Raise error when settings module is missing.

Pablo Hoffmandd13dfe82bd6
diff --git a/scrapy/utils/project.py b/scrapy/utils/project.py
index a64fcda4f..a2edb7b08 100644
--- a/scrapy/utils/project.py
+++ b/scrapy/utils/project.py
@@ -51,10 +51,10 @@ def get_project_settings():
if ENVVAR not in os.environ:
project = os.environ.get('SCRAPY_PROJECT', 'default')
init_env(project)
- settings_module_path = os.environ.get(ENVVAR, 'scrapy_settings')
- try:
+ settings_module_path = os.environ.get(ENVVAR)
+ if settings_module_path:
settings_module = __import__(settings_module_path, {}, {}, [''])
- except ImportError:
+ else:
settings_module = None
settings = CrawlerSettings(settings_module)
diff --git a/scrapy/utils/testproc.py b/scrapy/utils/testproc.py
index 22239d82f..cba3b4346 100644
--- a/scrapy/utils/testproc.py
+++ b/scrapy/utils/testproc.py
@@ -9,9 +9,10 @@ class ProcessTest(object):
prefix = [sys.executable, '-m', 'scrapy.cmdline']
cwd = os.getcwd() # trial chdirs to temp dir
- def execute(self, args, check_code=True, settings='missing'):
+ def execute(self, args, check_code=True, settings=None):
env = os.environ.copy()
- env['SCRAPY_SETTINGS_MODULE'] = settings
+ if settings is not None:
+ env['SCRAPY_SETTINGS_MODULE'] = settings
cmd = self.prefix + [self.command] + list(args)
pp = TestProcessProtocol()
pp.deferred.addBoth(self._process_finished, cmd, check_code)