-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Verify SPIDER_MANAGER_CLASS interface while loading it in CrawlerRunner #1148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify SPIDER_MANAGER_CLASS interface while loading it in CrawlerRunner #1148
Conversation
Verify SPIDER_MANAGER_CLASS interface while loading it in CrawlerRunner
This change broke some SpiderManager implementations which don't implement |
@@ -42,3 +43,19 @@ class CustomSettingsSpider(DefaultSpider): | |||
|
|||
self.assertFalse(settings.frozen) | |||
self.assertTrue(crawler.settings.frozen) | |||
|
|||
|
|||
def SpiderManagerWithWrongInterface(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why def?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh god, why did we merged this (should be 'class', got a little too functional there). I'm not even sure how the test is working.
About I still prefer this check being done over the complete interface, but we could change it. |
Now that I think of it again maybe we could issue a warning instead of an exception if SpiderManager (soon to be SpiderLoader) doesn't comply with the interface, seems like it's the more tolerant alternative. Another option could be to raise an exception if the absolutely needed methods to run are not implemented (which I think are I like both options (but the first one slightly more). |
@kmike pointed me into this issue. Looks like my problem is related. I'm having an error and getting |
Discussed in #873.