File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
import warnings
2
2
import unittest
3
3
4
+ import scrapy
4
5
from scrapy .crawler import Crawler , CrawlerRunner , CrawlerProcess
5
6
from scrapy .settings import Settings , default_settings
6
7
from scrapy .spiderloader import SpiderLoader
7
8
from scrapy .utils .spider import DefaultSpider
8
9
from scrapy .utils .misc import load_object
10
+ from scrapy .extensions .throttle import AutoThrottle
9
11
10
12
11
13
class CrawlerTestCase (unittest .TestCase ):
@@ -52,6 +54,18 @@ def test_crawler_accepts_dict(self):
52
54
self .assertIsInstance (crawler .settings , Settings )
53
55
54
56
57
+ class SpiderSettingsTestCase (unittest .TestCase ):
58
+ def test_spider_custom_settings (self ):
59
+ class MySpider (scrapy .Spider ):
60
+ name = 'spider'
61
+ custom_settings = {
62
+ 'AUTOTHROTTLE_ENABLED' : True
63
+ }
64
+
65
+ crawler = Crawler (MySpider , {})
66
+ enabled_exts = [e .__class__ for e in crawler .extensions .middlewares ]
67
+ self .assertIn (AutoThrottle , enabled_exts )
68
+
55
69
56
70
class SpiderLoaderWithWrongInterface (object ):
57
71
You can’t perform that action at this time.
0 commit comments