1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 14:04:01 +00:00

Update get_crawler method in utils/test.py with new Settings interface

This early adaptation of the new Settings interface is needed for running tests
This commit is contained in:
Julia Medina 2014-05-24 08:06:00 -03:00
parent ed033854e2
commit b397f5e935

View File

@ -22,20 +22,13 @@ def assert_aws_environ():
def get_crawler(settings_dict=None):
"""Return an unconfigured Crawler object. If settings_dict is given, it
will be used as the settings present in the settings module of the
CrawlerSettings.
will be used to populate the crawler settings with a project level
priority.
"""
from scrapy.crawler import Crawler
from scrapy.settings import CrawlerSettings
from scrapy.settings import Settings
class SettingsModuleMock(object):
pass
settings_module = SettingsModuleMock()
if settings_dict:
for k, v in settings_dict.items():
setattr(settings_module, k, v)
settings = CrawlerSettings(settings_module)
return Crawler(settings)
return Crawler(Settings(settings_dict))
def get_pythonpath():
"""Return a PYTHONPATH suitable to use in processes so that they find this