Skip to content

Commit 2969537

Browse files
committed
Add test for raised exception with SpiderState extension when no JOBDIR used
1 parent 0349bbf commit 2969537

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_spiderstate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from scrapy.extensions.spiderstate import SpiderState
66
from scrapy.spiders import Spider
7+
from scrapy.exceptions import NotConfigured
8+
from scrapy.utils.test import get_crawler
79

810

911
class SpiderStateTest(unittest.TestCase):
@@ -34,3 +36,7 @@ def test_state_attribute(self):
3436
ss.spider_opened(spider)
3537
self.assertEqual(spider.state, {})
3638
ss.spider_closed(spider)
39+
40+
def test_not_configured(self):
41+
crawler = get_crawler(Spider)
42+
self.assertRaises(NotConfigured, SpiderState.from_crawler, crawler)

0 commit comments

Comments
 (0)