Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f37592fd
Commit
f37592fd
authored
Apr 02, 2010
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport some robotparser test and skip the test if the external resource is not available.
parent
d54e699c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
Lib/test/test_robotparser.py
Lib/test/test_robotparser.py
+18
-5
No files found.
Lib/test/test_robotparser.py
View file @
f37592fd
...
...
@@ -203,19 +203,32 @@ RobotTest(13, doc, good, bad, agent="googlebot")
class
TestCase
(
unittest
.
TestCase
):
def
runTest
(
self
):
class
NetworkTestCase
(
unittest
.
TestCase
):
def
testPasswordProtectedSite
(
self
):
test_support
.
requires
(
'network'
)
#
whole site is password-protected.
#
XXX it depends on an external resource which could be unavailable
url
=
'http://mueblesmoraleda.com'
parser
=
robotparser
.
RobotFileParser
()
parser
.
set_url
(
url
)
parser
.
read
()
try
:
parser
.
read
()
except
IOError
:
self
.
skipTest
(
'%s is unavailable'
%
url
)
self
.
assertEqual
(
parser
.
can_fetch
(
"*"
,
url
+
"/robots.txt"
),
False
)
def
testPythonOrg
(
self
):
test_support
.
requires
(
'network'
)
parser
=
robotparser
.
RobotFileParser
(
"http://www.python.org/robots.txt"
)
parser
.
read
()
self
.
assertTrue
(
parser
.
can_fetch
(
"*"
,
"http://www.python.org/robots.txt"
))
def
test_main
():
test_support
.
run_unittest
(
tests
)
TestCase
().
run
(
)
test_support
.
run_unittest
(
NetworkTestCase
)
if
__name__
==
'__main__'
:
test_support
.
verbose
=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment