-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Issue #3264, fix error handling when spider is not matched #5497
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
Issue #3264, fix error handling when spider is not matched #5497
Conversation
Changes Implementation: - Check whether Spider exists or is None, and if it's None skip execution of start_requests() with non existing Spider Testing: - Add a test case with invalid url inside test_command_parse Test proves that non-matched Spider does not throw an AttributeError
@@ -222,6 +223,10 @@ def test_crawlspider_no_matching_rule(self): | |||
self.assertRegex(_textmode(out), r"""# Scraped Items -+\n\[\]""") | |||
self.assertIn("""Cannot find a rule that matches""", _textmode(stderr)) | |||
|
|||
status, out, stderr = yield self.execute([self.url('/invalid_url')]) |
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.
Please, give this test its own test method instead of running it within the existing test_crawlspider_no_matching_rule
.
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.
Thanks @Gallaecio , should I use also the decorator @defer.inlineCallbacks in my new test?
Codecov Report
@@ Coverage Diff @@
## master #5497 +/- ##
==========================================
+ Coverage 88.58% 88.74% +0.15%
==========================================
Files 163 163
Lines 10666 10671 +5
Branches 1818 1819 +1
==========================================
+ Hits 9449 9470 +21
+ Misses 941 926 -15
+ Partials 276 275 -1
|
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.
Looks good to me, thanks!
Thanks @andreastziortz! |
Changes
Implementation:
Testing:
Test proves that non-matched Spider does not throw an AttributeError
Fixes #3264, resolves #5376