示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 def test_crawler_defaults(self):
     crawler = get_crawler({'DOWNLOAD_TIMEOUT': '3'})
     settings = SpiderSettings(BaseSpider('name'), crawler.settings)
     self.assertEqual(settings.getint('DOWNLOAD_TIMEOUT'), 3)
示例#5
0
 def settings(self):
     if not hasattr(self, '_settings'):
         self._settings = SpiderSettings(self, self.crawler.settings)
     return self._settings
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 def test_crawler_defaults(self):
     crawler = get_crawler({'DOWNLOAD_TIMEOUT': '3'})
     settings = SpiderSettings(BaseSpider('name'), crawler.settings)
     self.assertEqual(settings.getint('DOWNLOAD_TIMEOUT'), 3)
示例#9
0
 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)