[Python-checkins] r79638 - python/branches/release31-maint/Lib/test/test_robotparser.py

florent.xicluna python-checkins at python.org
Sat Apr 3 02:45:27 CEST 2010


Author: florent.xicluna
Date: Sat Apr  3 02:45:27 2010
New Revision: 79638

Log:
Merged revision 79605 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r79605 | antoine.pitrou | 2010-04-02 19:12:12 +0200 (ven, 02 avr 2010) | 3 lines
  
  Furniture is not very reliable these days (buildbot failures).
........


Modified:
   python/branches/release31-maint/Lib/test/test_robotparser.py

Modified: python/branches/release31-maint/Lib/test/test_robotparser.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_robotparser.py	(original)
+++ python/branches/release31-maint/Lib/test/test_robotparser.py	Sat Apr  3 02:45:27 2010
@@ -1,6 +1,7 @@
 import io
 import unittest
 import urllib.robotparser
+from urllib.error import URLError
 from test import support
 
 class RobotTestCase(unittest.TestCase):
@@ -208,18 +209,19 @@
 class NetworkTestCase(unittest.TestCase):
 
     def testPasswordProtectedSite(self):
-        if not support.is_resource_enabled('network'):
-            return
-        # whole site is password-protected.
+        support.requires('network')
+        # XXX it depends on an external resource which could be unavailable
         url = 'http://mueblesmoraleda.com'
         parser = urllib.robotparser.RobotFileParser()
         parser.set_url(url)
-        parser.read()
+        try:
+            parser.read()
+        except URLError:
+            self.skipTest('%s is unavailable' % url)
         self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False)
 
     def testPythonOrg(self):
-        if not support.is_resource_enabled('network'):
-            return
+        support.requires('network')
         parser = urllib.robotparser.RobotFileParser(
             "http://www.python.org/robots.txt")
         parser.read()


More information about the Python-checkins mailing list