Unit tests failing

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unit tests failing

ejohnso9

Hi,

    I am brand new to CherryPy... I need to build a rather small and fairly simple web application and I thougt CherryPy looked like a good framework to explore while doing this simple work project.  Unfortunately, I am off to a rather disappointing start: several of the unit tests are failing for version 3 and pretty much all of them for version 2.2.1.

  version 2.2.1 tests error something like this:

======================================================================
ERROR: test_04_static_subdir (test_wsgiapp_filter.WSGIAppFilterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/ej/CherryPy-2.2.1/cherrypy/test/test_wsgiapp_filter.py", line 70, in test_04_static_subdir
    self.getPage("/hosted/app0/static/index.html")
  File "/home/ej/CherryPy-2.2.1/cherrypy/test/helper.py", line 48, in getPage
    webtest.WebCase.getPage(self, url, headers, method, body, protocol)
  File "/home/ej/CherryPy-2.2.1/cherrypy/test/webtest.py", line 150, in getPage
    self.HTTP_CONN, protocol)
  File "/home/ej/CherryPy-2.2.1/cherrypy/test/webtest.py", line 372, in openURL
    skip_host=True, skip_accept_encoding=True)
TypeError: putrequest() got an unexpected keyword argument 'skip_accept_encoding'


    I have been programming Python for a little over two years now, but I'm not exactly a "Big Dog Programmer". I have got a few of the HelloWorld type applications and tutorials working so, I know at least some of this is working right....  not reallying knowing anything about CherryPy, I'm wondering if any developers are interested in working with me to get to the bottom of these errors?  If so, you can reply directly to me at this address: [hidden email]   (there's a spam filter - if you don't mind answering the auto-reply, that would make it a lot easier for me to find your mail!)

Thanks!
-ej


Output of the units tests for version 3 follows.  (This is on Suse Linux (9.2?) on an Intel Dell server):

> uname -a
Linux mako 2.6.8-24-smp #1 SMP Wed Oct 6 09:16:23 UTC 2004 i686 i686 i386 GNU/Linux

> python test.py
Python version used to run this test script: 2.3.4
CherryPy version 3.0.0beta2
HTTP server version HTTP/1.1


Running tests: cherrypy._cpwsgi.WSGIServer
No handlers could be found for logger "cherrypy.error"
testProxy (test_proxy.ProxyTest) ... ok
testCaching (test_caching.CacheTest) ... ok
testExpiresTool (test_caching.CacheTest) ... ok
testConfig (test_config.ConfigTests) ... ok
testCustomNamespaces (test_config.ConfigTests) ... ok
test_100_Continue (test_conn.ConnectionTests) ... ok
test_Chunked_Encoding (test_conn.ConnectionTests) ... ok
test_HTTP10 (test_conn.ConnectionTests) ... ok
test_HTTP11 (test_conn.ConnectionTests) ... ok
test_HTTP11_Timeout (test_conn.ConnectionTests) ... ok
test_HTTP11_pipelining (test_conn.ConnectionTests) ... ok
testCookies (test_core.CoreRequestHandlingTest) ... ok
testDefaultContentType (test_core.CoreRequestHandlingTest) ... ok
testEmptyThreadlocals (test_core.CoreRequestHandlingTest) ... ok
testErrorHandling (test_core.CoreRequestHandlingTest) ... ok
testExpect (test_core.CoreRequestHandlingTest) ... ok
testFavicon (test_core.CoreRequestHandlingTest) ... ok
testFlatten (test_core.CoreRequestHandlingTest) ... ok
testHTTPMethods (test_core.CoreRequestHandlingTest) ... ok
testHeaderElements (test_core.CoreRequestHandlingTest) ...
    ERROR: expected body:
'gzip;q=1.0\nidentity;q=0.5\n*;q=0'

actual body:
'identity\ngzip;q=1.0\nidentity;q=0.5\n*;q=0'
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  B
identity
gzip;q=1.0
identity;q=0.5
*;q=0
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  R
FAIL
testHeaders (test_core.CoreRequestHandlingTest) ... ok
testLogging (test_core.CoreRequestHandlingTest) ... ok
testMaxRequestSize (test_core.CoreRequestHandlingTest) ... ok
testParams (test_core.CoreRequestHandlingTest) ... ok
testRanges (test_core.CoreRequestHandlingTest) ... ok
testRedirect (test_core.CoreRequestHandlingTest) ... ok
testSlashes (test_core.CoreRequestHandlingTest) ... ok
testStatus (test_core.CoreRequestHandlingTest) ... ok
test_cherrypy_url (test_core.CoreRequestHandlingTest) ... ok

======================================================================
FAIL: testHeaderElements (test_core.CoreRequestHandlingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/test_core.py", line 780, in testHeaderElements
    self.assertBody("gzip;q=1.0\n"
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 341, in assertBody
    self._handlewebError(msg)
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 200, in _handlewebError
    raise self.failureException(msg)
AssertionError: expected body:
'gzip;q=1.0\nidentity;q=0.5\n*;q=0'

actual body:
'identity\ngzip;q=1.0\nidentity;q=0.5\n*;q=0'

FAILED (failures=1)
testBareHooks (test_tools.ToolTests) ... ok
testCombinedTools (test_tools.ToolTests) ...
    ERROR: '\x1f\x8b\x08' not in body
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  B
Hello,world£
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  R
FAIL
testDemo (test_tools.ToolTests) ...
    ERROR: expected body:
'True'

actual body:
'False'
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  R
FAIL
testGuaranteedHooks (test_tools.ToolTests) ... ok

======================================================================
FAIL: testCombinedTools (test_tools.ToolTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/test_tools.py", line 242, in testCombinedTools
    self.assertInBody(zbuf.getvalue()[:3])
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 348, in assertInBody
    self._handlewebError(msg)
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 200, in _handlewebError
    raise self.failureException(msg)
AssertionError: '\x1f\x8b\x08' not in body

======================================================================
FAIL: testDemo (test_tools.ToolTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/test_tools.py", line 199, in testDemo
    self.assertBody("True")
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 341, in assertBody
    self._handlewebError(msg)
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 200, in _handlewebError
    raise self.failureException(msg)
AssertionError: expected body:
'True'

actual body:
'False'

FAILED (failures=2)
testDecoding (test_encoding.EncodingTests) ... ok
testEncoding (test_encoding.EncodingTests) ... ok
testGzip (test_encoding.EncodingTests) ...
    ERROR: '\x1f\x8b\x08' not in body
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  B
Hello, world
    Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise, or sys.e[X]it >>  R
FAIL

======================================================================
FAIL: testGzip (test_encoding.EncodingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/test_encoding.py", line 107, in testGzip
    self.assertInBody(zbuf.getvalue()[:3])
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 348, in assertInBody
    self._handlewebError(msg)
  File "/usr/home/ej/CherryPy-3.0.0beta2/cherrypy/test/webtest.py", line 200, in _handlewebError
    raise self.failureException(msg)
AssertionError: '\x1f\x8b\x08' not in body

FAILED (failures=1)
testETags (test_etags.ETagTest) ... ok
testExpose (test_objectmapping.ObjectMappingTest) ... ok
testMethodDispatch (test_objectmapping.ObjectMappingTest) ... ok
testObjectMapping (test_objectmapping.ObjectMappingTest) ... ok
testPositionalParams (test_objectmapping.ObjectMappingTest) ... ok
testReferer (test_misc_tools.RefererTest) ... ok
testResponseHeaders (test_misc_tools.ResponseHeadersTest) ... ok
testResponseHeadersDecorator (test_misc_tools.ResponseHeadersTest) ... ok
testStatic (test_static.StaticTest) ... ok
test01HelloWorld (test_tutorials.TutorialTest) ... ok
test02ExposeMethods (test_tutorials.TutorialTest) ... ok
test03GetAndPost (test_tutorials.TutorialTest) ... ok
test04ComplexSite (test_tutorials.TutorialTest) ... ok
test05DerivedObjects (test_tutorials.TutorialTest) ... ok
test06DefaultMethod (test_tutorials.TutorialTest) ... ok
test07Sessions (test_tutorials.TutorialTest) ... ok
test08GeneratorsAndYield (test_tutorials.TutorialTest) ... ok
test09Files (test_tutorials.TutorialTest) ... ok
test10HTTPErrors (test_tutorials.TutorialTest) ... ok
testVirtualHost (test_virtualhost.VirtualHostTest) ... ok
test_0_Session (test_session.SessionTest) ... ok
test_1_Ram_Concurrency (test_session.SessionTest) ... ok
test_2_File_Concurrency (test_session.SessionTest) ... ok
testSessionAuthenticate (test_sessionauthenticate.SessionAuthenticateTest) ... ok
testXmlRpc (test_xmlrpc.XmlRpcTest) ... ok
test_01_standard_app (test_wsgiapps.WSGIAppTest) ... ok
test_02_wrapped_wsgi (test_wsgiapps.WSGIAppTest) ... ok
test_03_static_subdir (test_wsgiapps.WSGIAppTest) ... ok
test_04_pure_wsgi (test_wsgiapps.WSGIAppTest) ... ok
test_05_wrapped_cp_app (test_wsgiapps.WSGIAppTest) ... ok
test_pipeline (test_wsgi_ns.WSGI_Namespace_Test) ... ok

hit enter



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Unit tests failing

Robert Brewer

[hidden email] wrote:

>   version 2.2.1 tests error something like this:
>
> ======================================================================
> ERROR: test_04_static_subdir (test_wsgiapp_filter.WSGIAppFilterTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "/usr/home/ej/CherryPy-2.2.1/cherrypy/test/test_wsgiapp_filter
> .py", line 70, in test_04_static_subdir
>     self.getPage("/hosted/app0/static/index.html")
>   File "/home/ej/CherryPy-2.2.1/cherrypy/test/helper.py",
> line 48, in getPage
>     webtest.WebCase.getPage(self, url, headers, method, body,
> protocol)
>   File "/home/ej/CherryPy-2.2.1/cherrypy/test/webtest.py",
> line 150, in getPage
>     self.HTTP_CONN, protocol)
>   File "/home/ej/CherryPy-2.2.1/cherrypy/test/webtest.py",
> line 372, in openURL
>     skip_host=True, skip_accept_encoding=True)
> TypeError: putrequest() got an unexpected keyword argument
> 'skip_accept_encoding'

This is only a problem with the test suite: Python's HTTPConnection didn't take a skip_accept_encoding arg until Python 2.4. This is fixed in trunk, at least.

> Output of the units tests for version 3 follows.  (This is on
> Suse Linux (9.2?) on an Intel Dell server):
>
> > uname -a
> Linux mako 2.6.8-24-smp #1 SMP Wed Oct 6 09:16:23 UTC 2004
> i686 i686 i386 GNU/Linux
>
> > python test.py
> Python version used to run this test script: 2.3.4
> CherryPy version 3.0.0beta2
> HTTP server version HTTP/1.1
>
>
> Running tests: cherrypy._cpwsgi.WSGIServer
> No handlers could be found for logger "cherrypy.error"
> testHeaderElements (test_core.CoreRequestHandlingTest) ...
>     ERROR: expected body:
> 'gzip;q=1.0\nidentity;q=0.5\n*;q=0'
>
> actual body:
> 'identity\ngzip;q=1.0\nidentity;q=0.5\n*;q=0'
>     Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise,
> or sys.e[X]it >>  B
> identity
> gzip;q=1.0
> identity;q=0.5
> *;q=0
>     Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise,
> or sys.e[X]it >>  R
> FAIL

I'm pretty sure this has been fixed in trunk, also, and is due to a change in Python's stdlib, as well. IIRC, HTTPConnection started prepending "identity" to the header value regardless of the existing contents. It's compliant with the HTTP spec; again, an oversight in the test suite. Not dangerous.

> testCombinedTools (test_tools.ToolTests) ...
>     ERROR: '\x1f\x8b\x08' not in body
>     Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise,
> or sys.e[X]it >>  B
> Hello,world£
>     Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise,
> or sys.e[X]it >>  R
> FAIL

Not sure on this one. It's the same as the gzip error. I'll do some research and see if I can't reproduce it.

> testDemo (test_tools.ToolTests) ...
>     ERROR: expected body:
> 'True'
>
> actual body:
> 'False'
>     Show: [B]ody [H]eaders [S]tatus [U]RL; [I]gnore, [R]aise,
> or sys.e[X]it >>  R
> FAIL

This is an itermittent error that I know about and just haven't fixed yet. It's an order-of-thread-execution issue, and not dangerous. It just needs some serialization code in the actual test.

Thanks for the detailed report! :)


Robert Brewer
System Architect
Amor Ministries
[hidden email]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Unit tests failing

Robert Brewer

Robert Brewer wrote:

> [hidden email] wrote:
> > TypeError: putrequest() got an unexpected keyword argument
> > 'skip_accept_encoding'
>
> This is only a problem with the test suite: Python's
> HTTPConnection didn't take a skip_accept_encoding
> arg until Python 2.4. This is fixed in trunk, at least.
>
> > testHeaderElements (test_core.CoreRequestHandlingTest) ...
> >     ERROR: expected body:
> > 'gzip;q=1.0\nidentity;q=0.5\n*;q=0'
>
> I'm pretty sure this has been fixed in trunk, also, and is due
> to a change in Python's stdlib, as well. IIRC, HTTPConnection
> started prepending "identity" to the header value regardless
> of the existing contents. It's compliant with the HTTP spec;
> again, an oversight in the test suite. Not dangerous.
>
> > testCombinedTools (test_tools.ToolTests) ...
> >     ERROR: '\x1f\x8b\x08' not in body
>
> Not sure on this one. It's the same as the gzip error.
> I'll do some research and see if I can't reproduce it.

All of these have been fixed in trunk now (by monkeypatching
httplib.HTTPConnection.putheader for Python 2.3).


Robert Brewer
System Architect
Amor Ministries
[hidden email]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-devel
-~----------~----~----~----~------~----~------~--~---