Skip to content
Permalink
Browse files

localhost666 can resolve under certain circumstances

localhost666 is resolvable if the host running the tests contains a
"search mydomain.com" in /etc/resolv.conf and a wildcard dns entry
exists for *.mydomain.com
  • Loading branch information
dangra committed Feb 8, 2014
1 parent cc3eda3 commit 2ec22793cb31f84e0021a8e16c3c92608d748255
Showing with 7 additions and 3 deletions.
  1. +7 −3 scrapy/tests/test_crawl.py
@@ -1,4 +1,6 @@
import json
import socket
import mock
from twisted.internet import defer
from twisted.trial.unittest import TestCase
from scrapy.utils.test import get_crawler, get_testlog
@@ -88,9 +90,11 @@ def test_retry_conn_failed(self):

@defer.inlineCallbacks
def test_retry_dns_error(self):
spider = SimpleSpider("http://localhost666/status?n=503")
yield docrawl(spider)
self._assert_retried()
with mock.patch('socket.gethostbyname',
side_effect=socket.gaierror(-5, 'No address associated with hostname')):
spider = SimpleSpider("http://example.com/")
yield docrawl(spider)
self._assert_retried()

@defer.inlineCallbacks
def test_start_requests_bug_before_yield(self):

0 comments on commit 2ec2279

Please sign in to comment.
You can’t perform that action at this time.