Ticket #495 (defect)
Opened 3 years ago
Last modified 3 years ago
Tutorial tests fail
Status: closed (fixed)
| Reported by: | fumanchu | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.2-final |
| Component: | CherryPy code | Keywords: | |
| Cc: |
C:\Python24\Lib\site-packages>python cherrypy\test\test_tutorials.py
21/Mar/2006:11:01:31 CONFIG INFO Server parameters:
21/Mar/2006:11:01:31 CONFIG INFO server.environment: development
21/Mar/2006:11:01:31 CONFIG INFO server.log_to_screen: True
21/Mar/2006:11:01:31 CONFIG INFO server.log_file:
21/Mar/2006:11:01:31 CONFIG INFO server.log_tracebacks: True
21/Mar/2006:11:01:31 CONFIG INFO server.log_request_headers: True
21/Mar/2006:11:01:31 CONFIG INFO server.protocol_version: HTTP/1.0
21/Mar/2006:11:01:31 CONFIG INFO server.socket_host:
21/Mar/2006:11:01:31 CONFIG INFO server.socket_port: 8080
21/Mar/2006:11:01:31 CONFIG INFO server.socket_file:
21/Mar/2006:11:01:31 CONFIG INFO server.reverse_dns: False
21/Mar/2006:11:01:31 CONFIG INFO server.socket_queue_size: 5
21/Mar/2006:11:01:31 CONFIG INFO server.thread_pool: 10
.
ERROR: expected body:
'Hello world!'
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/showMessage\' was not found.</p>\n <pre id="tracebac
k"></pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span
>\n </div>\n </body>\n</html>\n'
Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> R
F
ERROR: expected body:
"Hey Bob, what's up?"
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/greetUser\' was not found.</p>\n <pre id="traceback"
></pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span>\
n </div>\n </body>\n</html>\n'
Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> R
F..
ERROR: expected body:
'Hendrik Mans, CherryPy co-developer & crazy German (<a href="./">back</a>)'
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/hendrik\' was not found.</p>\n <pre id="traceback"><
/pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span>\n
</div>\n </body>\n</html>\n'
Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> R
F..
ERROR: expected body:
'<html>\n <body>\n myFile length: 5<br />\n myFile filename: hello.txt<br />\n m
yFile mime-type: text/plain\n </body>\n </html>'
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/upload\' was not found.</p>\n <pre id="traceback"></
pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span>\n
</div>\n </body>\n</html>\n'
Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >> R
FF
======================================================================
FAIL: test02ExposeMethods (__main__.TutorialTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 223, in __call__
testMethod()
File "cherrypy\test\test_tutorials.py", line 37, in test02ExposeMethods
self.assertBody('Hello world!')
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 286, in assertBody
self._handlewebError(msg)
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 199, in _handlewebError
raise self.failureException(msg)
AssertionError: expected body:
'Hello world!'
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/showMessage\' was not found.</p>\n <pre id="tracebac
k"></pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span
>\n </div>\n </body>\n</html>\n'
======================================================================
FAIL: test03GetAndPost (__main__.TutorialTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 223, in __call__
testMethod()
File "cherrypy\test\test_tutorials.py", line 44, in test03GetAndPost
self.assertBody("Hey Bob, what's up?")
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 286, in assertBody
self._handlewebError(msg)
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 199, in _handlewebError
raise self.failureException(msg)
AssertionError: expected body:
"Hey Bob, what's up?"
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/greetUser\' was not found.</p>\n <pre id="traceback"
></pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span>\
n </div>\n </body>\n</html>\n'
======================================================================
FAIL: test06DefaultMethod (__main__.TutorialTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 223, in __call__
testMethod()
File "cherrypy\test\test_tutorials.py", line 96, in test06DefaultMethod
self.assertBody('Hendrik Mans, CherryPy co-developer & crazy German '
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 286, in assertBody
self._handlewebError(msg)
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 199, in _handlewebError
raise self.failureException(msg)
AssertionError: expected body:
'Hendrik Mans, CherryPy co-developer & crazy German (<a href="./">back</a>)'
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/hendrik\' was not found.</p>\n <pre id="traceback"><
/pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span>\n
</div>\n </body>\n</html>\n'
======================================================================
FAIL: test09Files (__main__.TutorialTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 223, in __call__
testMethod()
File "cherrypy\test\test_tutorials.py", line 134, in test09Files
self.assertBody('''<html>
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 286, in assertBody
self._handlewebError(msg)
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 199, in _handlewebError
raise self.failureException(msg)
AssertionError: expected body:
'<html>\n <body>\n myFile length: 5<br />\n myFile filename: hello.txt<br />\n m
yFile mime-type: text/plain\n </body>\n </html>'
actual body:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n<html>\n<head>\n <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>\n <title>404 Not F
ound</title>\n <style type="text/css">\n #powered_by {\n margin-top: 20px;\n border-top: 2px solid b
lack;\n font-style: italic;\n }\n\n #traceback {\n color: red;\n }\n </style>\n</head>\n <b
ody>\n <h2>404 Not Found</h2>\n <p>The path \'/upload\' was not found.</p>\n <pre id="traceback"></
pre>\n <div id="powered_by">\n <span>Powered by <a href="http://www.cherrypy.org">CherryPy 2.2.0rc1</a></span>\n
</div>\n </body>\n</html>\n'
======================================================================
FAIL: test10HTTPErrors (__main__.TutorialTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\Python24\lib\site-packages\cherrypy\test\webtest.py", line 223, in __call__
testMethod()
File "cherrypy\test\test_tutorials.py", line 161, in test10HTTPErrors
self.assertEqual(cherrypy.config.get('server.show_tracebacks'), not tracebacks)
AssertionError: False != True
----------------------------------------------------------------------
Ran 10 tests in 8.101s
FAILED (failures=5)
21/Mar/2006:11:01:40 ENGINE INFO SystemExit raised: shutting down autoreloader
21/Mar/2006:11:01:40 ENGINE INFO CherryPy shut down
Change History
03/22/06 09:46:42: Modified by dowski
03/29/06 00:55:35: Modified by fumanchu
- status changed from new to closed.
- resolution set to fixed.
Fixed in [1022].


The problem comes down to the CherryPy app server being started with nothing mounted at cherrypy.root. I actually noticed this when I was doing my interactive CherryPy screencast, but I didn't really consider it a bug at the time. I suppose it could be frustrating for someone doing something "creative" with CP.
Also, I think that test_tutorials should set server.environment = 'production'.