def test_spider_overrides_crawler(self): crawler = get_crawler({'DOWNLOAD_TIMEOUT': '3'}) crawler.settings.defaults['DOWNLOAD_TIMEOUT'] = '99' settings = SpiderSettings(BaseSpider('name', DOWNLOAD_TIMEOUT='12'), crawler.settings) self.assertEqual(settings.getint('DOWNLOAD_TIMEOUT'), 12)
def test_overrides_most_precedence(self): crawler = get_crawler({'DOWNLOAD_TIMEOUT': '3'}) crawler.settings.overrides['DOWNLOAD_TIMEOUT'] = '15' settings = SpiderSettings(BaseSpider('name', DOWNLOAD_TIMEOUT='12'), crawler.settings) self.assertEqual(settings.getint('DOWNLOAD_TIMEOUT'), 15)
def test_defaults(self): crawler = get_crawler() crawler.settings.defaults['DOWNLOAD_TIMEOUT'] = '99' settings = SpiderSettings(BaseSpider('name'), crawler.settings) self.assertEqual(settings.getint('DOWNLOAD_TIMEOUT'), 99)
def test_crawler_defaults(self): crawler = get_crawler({'DOWNLOAD_TIMEOUT': '3'}) settings = SpiderSettings(BaseSpider('name'), crawler.settings) self.assertEqual(settings.getint('DOWNLOAD_TIMEOUT'), 3)
def settings(self): if not hasattr(self, '_settings'): self._settings = SpiderSettings(self, self.crawler.settings) return self._settings