diff options
Diffstat (limited to 'Lib/test/test_robotparser.py')
-rw-r--r-- | Lib/test/test_robotparser.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_robotparser.py b/Lib/test/test_robotparser.py index 86ebe9f..4c3b536 100644 --- a/Lib/test/test_robotparser.py +++ b/Lib/test/test_robotparser.py @@ -209,21 +209,19 @@ RobotTest(13, doc, good, bad, agent="googlebot") 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) try: parser.read() - self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) except URLError: - self.skipTest('mueblesmoraleda.com is unavailable') + 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() |