Modify ↓
#13233 closed defect (fixed)
Functional test is failed in AppVeyor on Python 2.7.17
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.20 |
Component: | general | Version: | 1.2.5 |
Severity: | normal | Keywords: | travis-ci |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Work around for |
Description
====================================================================== ERROR: runTest (trac.tests.functional.testcases.RegressionTestTicket3663) Regression test for non-UTF-8 PATH_INFO (#3663) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\projects\trac\trac\tests\functional\testcases.py", line 301, in runTest self._tester.go_to_wiki(u'été'.encode('latin1')) File "C:\projects\trac\trac\tests\functional\tester.py", line 148, in go_to_wiki self.go_to_url(wiki_url) File "C:\projects\trac\trac\tests\functional\tester.py", line 117, in go_to_url tc.go(url) File "C:\Python27\lib\site-packages\twill\commands.py", line 112, in go browser.go(url) File "C:\Python27\lib\site-packages\twill\browser.py", line 113, in go self._journey('open', u) File "C:\Python27\lib\site-packages\twill\browser.py", line 523, in _journey r = func(*args, **kwargs) File "C:\Python27\lib\site-packages\twill\other_packages\_mechanize_dist\_mechanize.py", line 212, in open return self._mech_open(url, data) File "C:\Python27\lib\site-packages\twill\other_packages\_mechanize_dist\_mechanize.py", line 238, in _mech_open response = UserAgentBase.open(self, request, data) File "C:\Python27\lib\site-packages\twill\other_packages\_mechanize_dist\_opener.py", line 181, in open response = urlopen(self, req, data) File "C:\Python27\lib\urllib2.py", line 447, in _open '_open', req) File "C:\Python27\lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Python27\lib\site-packages\twill\_browser.py", line 16, in http_open return self.do_open(wsgi_intercept.WSGI_HTTPConnection, req) File "C:\Python27\lib\site-packages\twill\other_packages\_mechanize_dist\_http.py", line 674, in do_open h.request(req.get_method(), req.get_selector(), req.data, headers) File "C:\Python27\lib\httplib.py", line 1069, in request self._send_request(method, url, body, headers) File "C:\Python27\lib\httplib.py", line 1103, in _send_request self.putrequest(method, url, **skips) File "C:\Python27\lib\httplib.py", line 940, in putrequest self._validate_path(url) File "C:\Python27\lib\httplib.py", line 1030, in _validate_path raise InvalidURL(msg) InvalidURL: URL can't contain control characters. '/wiki/\xe9t\xe9' (found at least '\xe9')
See also:
Attachments (0)
Change History (4)
comment:1 by , 5 years ago
Keywords: | travis-ci added |
---|
comment:2 by , 5 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
The exception is raised from HTTPConnection._validate_path
in httplib
module. It is able to avoid to override _validate_path
of HTTPConnection
subclass but we cannot override the method because httplib is used from mechanize module bundled in twill module.
Instead, we could avoid the exception by monkey-patch of httplib._contains_disallowed_url_pchar_re
.
Results:
- Python 2.7.17 on OS X: https://travis-ci.org/jun66j5/trac/jobs/628593118
- Python 2.7.12 on Ubuntu: https://travis-ci.org/jun66j5/trac/jobs/628593113
-
trac/tests/functional/testcases.py
diff --git a/trac/tests/functional/testcases.py b/trac/tests/functional/testcases.py index 1ada3aeeb..ccae51f12 100755
a b def runTest(self): 237 237 238 238 Verify that URLs not encoded with UTF-8 are reported as invalid. 239 239 """ 240 # invalid PATH_INFO 241 self._tester.go_to_wiki(u'été'.encode('latin1')) 242 tc.code(404) 243 tc.find('Invalid URL encoding') 244 # invalid SCRIPT_NAME 245 tc.go(u'été'.encode('latin1')) 246 tc.code(404) 247 tc.find('Invalid URL encoding') 240 import httplib 241 try: 242 # Work around for InvalidURL since Python 2.7.17 (#13233) 243 saved_re = \ 244 httplib._contains_disallowed_url_pchar_re \ 245 if hasattr(httplib, '_contains_disallowed_url_pchar_re') \ 246 else None 247 if saved_re: 248 httplib._contains_disallowed_url_pchar_re = \ 249 re.compile(r'[\x00-\x20]') 250 # invalid PATH_INFO 251 self._tester.go_to_wiki(u'été'.encode('latin1')) 252 tc.code(404) 253 tc.find('Invalid URL encoding') 254 # invalid SCRIPT_NAME 255 tc.go(u'été'.encode('latin1')) 256 tc.code(404) 257 tc.find('Invalid URL encoding') 258 finally: 259 if saved_re: 260 httplib._contains_disallowed_url_pchar_re = saved_re 248 261 249 262 250 263 class RegressionTestTicket6318(FunctionalTwillTestCaseSetup):
comment:3 by , 5 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed in [17223] and merged in [17224-17226].
comment:4 by , 4 years ago
Note:
See TracTickets
for help on using tickets.
Similar failures on Travis CI