Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #663 (defect)

Opened 1 year ago

Last modified 1 year ago

test/test_routes() fails

Status: closed (fixed)

Reported by: stromnov@gmail.com Assigned to: rdelon
Priority: normal Milestone:
Component: CherryPy code Keywords:
Cc: stromnov@gmail.com

test/test_routes.py fails on my WinXP + Python 2.4 + CherryPy (rev 1623) + Routes (rev 332)

check fails at 2nd, 3rd and 4th tests ('/surbiton')

C:\Python24\Lib\site-packages\cherrypy\test>C:\Python24\python.exe test_routes.py
No handlers could be found for logger "cherrypy.error"
    ERROR: Status ('404 Not Found') != '200 OK'
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> U
/surbiton
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> S
404 Not Found
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> H
[('Date', 'Mon, 26 Feb 2007 09:20:08 GMT'),
 ('Content-Length', '1034'),
 ('Content-Type', 'text/html'),
 ('Server', 'CherryPy/3.0.1')]
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> R
======================================================================
FAIL: test_Routes_Dispatch (__main__.RoutesDispatchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 306, in __
call__
    testMethod()
  File "test_routes.py", line 49, in test_Routes_Dispatch
    self.assertStatus("200 OK")
  File "C:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 333, in as
sertStatus
    self._handlewebError(msg)
  File "C:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 244, in _h
andlewebError
    raise self.failureException(msg)
AssertionError: Status ('404 Not Found') != '200 OK'

----------------------------------------------------------------------
Ran 1 test in 30.421s

FAILED (failures=1)

Change History

02/26/07 03:39:41: Modified by lawouach

Interestingly this same revision does not make the test fail on my Linux box and I don't have a Windows at hand.

02/26/07 05:49:44: Modified by stromnov@gmail.com

FreeBSD 6.2-STABLE + + CherryPy (rev 1623) + Routes (rev 332)

# uname -a
FreeBSD zzzzz.ru 6.2-STABLE FreeBSD 6.2-STABLE #0

# python -V
Python 2.4.4

# python test_routes.py
No handlers could be found for logger "cherrypy.error"

    ERROR: Status ('404 Not Found') != '200 OK'
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  H
[('Date', 'Mon, 26 Feb 2007 11:44:52 GMT'),
 ('Content-Length', '1056'),
 ('Content-Type', 'text/html'),
 ('Server', 'CherryPy/3.0.1')]
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  S
404 Not Found
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  U
/surbiton
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  R
F
======================================================================
FAIL: test_Routes_Dispatch (__main__.RoutesDispatchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.4/site-packages/cherrypy/test/webtest.py", line 306, in __call__
    testMethod()
  File "test_routes.py", line 49, in test_Routes_Dispatch
    self.assertStatus("200 OK")
  File "/usr/local/lib/python2.4/site-packages/cherrypy/test/webtest.py", line 333, in assertStatus
    self._handlewebError(msg)
  File "/usr/local/lib/python2.4/site-packages/cherrypy/test/webtest.py", line 244, in _handlewebError
    raise self.failureException(msg)
AssertionError: Status ('404 Not Found') != '200 OK'

----------------------------------------------------------------------
Ran 1 test in 22.003s

FAILED (failures=1)

and

# python test_core.py
..........F........
======================================================================
FAIL: testLogging (__main__.CoreRequestHandlingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.4/site-packages/cherrypy/test/webtest.py", line 306, in __call__
    testMethod()
  File "test_core.py", line 493, in testLogging
    self.fail("%r doesn't start with %r" % (data[0], intro))
AssertionError: '82.146.xxx.xxx - - [26/Feb/2007:14:34:50] "GET /flatten/as_string HTTP/1.1" 200 7 "" ""\n' doesn't start with '127.0.0.1 - - ['

----------------------------------------------------------------------
Ran 19 tests in 15.260s

FAILED (failures=1)

03/04/07 06:07:14: Modified by lawouach

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [1625]

03/05/07 08:09:28: Modified by Andrew Stromnov <stromnov@gmail.com>

r1625 leads to CPChecker errors in some cases:

[05/Mar/2007:16:58:31] HTTP Serving HTTP on http://0.0.0.0:8080/
Traceback (most recent call last):
  File "C:\Projects\si\si.py", line 68, in ?
    cherrypy.engine.start()
  File "\Python24\Lib\site-packages\cherrypy\_cpengine.py", line 77, in start
    cherrypy.checker()
  File "\Python24\Lib\site-packages\cherrypy\_cpchecker.py", line 24, in __call__
    method()
  File "\Python24\Lib\site-packages\cherrypy\_cpchecker.py", line 55, in check_static_paths
    request.get_resource(section + "/dummy.html")
  File "\Python24\Lib\site-packages\cherrypy\_cprequest.py", line 628, in get_resource
    dispatch(path)
  File "C:\Python24\lib\site-packages\cherrypy\_cpdispatch.py", line 253, in __call__
    func = self.find_handler(path_info)
  File "C:\Python24\lib\site-packages\cherrypy\_cpdispatch.py", line 274, in find_handler
    result = self.mapper.match(path_info)
  File "\Python24\Lib\site-packages\routes\base.py", line 750, in match
    result = self._match(url)
  File "\Python24\Lib\site-packages\routes\base.py", line 733, in _match
    self.sub_domains_ignore, self.domain_match)
  File "\Python24\Lib\site-packages\routes\base.py", line 379, in match
    if environ.get('HTTP_HOST') and sub_domains:
  File "C:\Python24\lib\site-packages\cherrypy\_cpdispatch.py", line 224, in __getattr__
    return getattr(cherrypy.request.wsgi_environ, key)
  File "\Python24\Lib\site-packages\cherrypy\__init__.py", line 235, in __getattr__
    return getattr(child, name)
AttributeError: 'Request' object has no attribute 'wsgi_environ'

Hosted by WebFaction

Log in as guest/cpguest to create tickets