@@ -315,14 +315,13 @@ def test_populate_settings_keep_user_priorities(get_settings_mock):
315
315
'scrapy.contrib.throttle.AutoThrottle' : 5 }},
316
316
'enabled_addons' : [addon ]}
317
317
result = _populate_settings_base (api_settings , lambda x : x , spider = True )
318
- assert result .getdict ('EXTENSIONS_BASE' )[
319
- 'sh_scrapy.extension.HubstorageExtension' ] is None
320
- assert result .getdict ('EXTENSIONS_BASE' ).get (
321
- 'scrapy.contrib.throttle.AutoThrottle' ) is None
322
- assert result .getdict ('EXTENSIONS_BASE' )[
323
- 'scrapy.extensions.throttle.AutoThrottle' ] == 5
324
318
assert result .getdict ('SPIDER_MIDDLEWARES_BASE' )[
325
319
'scrapy.utils.misc.load_object' ] == 1
320
+ assert result .getdict ('EXTENSIONS_BASE' )[
321
+ 'sh_scrapy.extension.HubstorageExtension' ] is None
322
+ autothrottles = [k for k in result .getdict ('EXTENSIONS_BASE' )
323
+ if 'AutoThrottle' in k ]
324
+ assert result .getdict ('EXTENSIONS_BASE' )[autothrottles [0 ]] == 5
326
325
327
326
328
327
def test_populate_settings_unique_update_dict ():
@@ -343,8 +342,7 @@ def test_populate_settings_keep_user_priorities_oldpath(get_settings_mock):
343
342
autothrottles = [k for k in result .getdict ('EXTENSIONS_BASE' )
344
343
if 'AutoThrottle' in k ]
345
344
assert len (autothrottles ) == 1
346
- assert result .getdict ('EXTENSIONS_BASE' )[
347
- 'scrapy.extensions.throttle.AutoThrottle' ] is 0
345
+ assert result .getdict ('EXTENSIONS_BASE' )[autothrottles [0 ]] is 0
348
346
349
347
350
348
def test_load_default_settings ():
@@ -409,12 +407,12 @@ def test_update_old_classpaths_not_string():
409
407
class CustomObject (object ):
410
408
pass
411
409
412
- test_value = {'scrapy.contrib. exporter.CustomExporter' : 1 ,
410
+ test_value = {'scrapy.exporter.CustomExporter' : 1 ,
413
411
123 : 2 , CustomObject : 3 }
414
412
test_settings = Settings ({'SOME_SETTING' : test_value })
415
413
_update_old_classpaths (test_settings )
416
- expected = test_settings ['SOME_SETTING' ]. keys ()
414
+ expected = test_settings ['SOME_SETTING' ]
417
415
assert len (expected ) == 3
418
416
assert 123 in expected
419
417
assert CustomObject in expected
420
- assert 'scrapy.exporters .CustomExporter' in expected
418
+ assert 'scrapy.exporter .CustomExporter' in expected
0 commit comments