Opened 11 years ago

Closed 8 years ago

Last modified 8 years ago

#665 closed defect (fixed)

Tests fail for WebTest 2.0.2

Reported by: David Thompson Owned by:
Priority: major Milestone: 0.9.0
Component: programming Keywords: sprint, test
Cc: Parent Tickets:

Description

WebTest 2.0.2 breaks tests. :(

Currently, only 1 test is failing.

Using ./bin/nosetests
+ CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_tests
+ exec ./bin/nosetests ./mediagoblin/tests
...........E.............................................................................
======================================================================
ERROR: mediagoblin.tests.test_csrf_middleware.test_csrf_cookie_set
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dave/Code/mediagoblin/lib/python2.7/site-packages/nose-1.2.1-py2.7.egg/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/dave/Code/mediagoblin/mediagoblin/tests/test_csrf_middleware.py", line 30, in test_csrf_cookie_set
    assert cookie_name in response.cookies_set
AttributeError: 'TestResponse' object has no attribute 'cookies_set'
-------------------- >> begin captured logging << --------------------
mediagoblin.tools.routing: DEBUG: endpoint: mediagoblin.auth.login view_func: <function login at 0x49ad6e0>
--------------------- >> end captured logging << ---------------------
 
----------------------------------------------------------------------
Ran 89 tests in 131.405s
 
FAILED (errors=1)

Attachments (1)

issue_665.patch (2.2 KB ) - added by Ben Sturmfels 9 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Elrond, 11 years ago

Options:

  1. change dependencies to "webtest<2". This fill fix this quickly.
  2. Make the test work with webtest 1 and 2.

comment:2 by Elrond, 11 years ago

Keywords: sprint added

Option 1 is so easy, it can be done on the sprint. Maybe someone is good at those things and finds out, what's going on and fixes things.

comment:3 by Christopher Allan Webber, 11 years ago

I did number 1!

Last edited 11 years ago by Christopher Allan Webber (previous) (diff)

comment:4 by ShawnRisk, 10 years ago

Keywords: test added

comment:5 by Christopher Allan Webber, 10 years ago

We still don't know what's causing this. It would be something for someone to look into, probably comparatively fairly easy, though I'm not sure it's so easy to mark it bitesized. This is mostly a code sleuthing task at this point.

comment:6 by Ben Sturmfels, 9 years ago

Status: newreview

I've attached a patch to upgrade to WebTest 2.0.18 and fix broken test test_csrf_cookie_set.

Test was failing due to API change in WebTest around accessing cookies set in the test client. These are now in test_app.cookies.

While there are currently 48 other tests failing, I've verified that before and after this change that the same number fail. I've also checked that no other tests use the old API for accessing test client cookies.

I've pinned to version 2.0.18. My understanding is that it's generally a good idea to pin to a specific version where possible to avoid the "why has this suddenly broken" type bugs. This also seems appropriate since WebTest appears to be very stable.

by Ben Sturmfels, 9 years ago

Attachment: issue_665.patch added

comment:7 by Christopher Allan Webber, 8 years ago

Resolution: fixed
Status: reviewclosed

Okay, so this is great! I merged and pushed.

As an aside, I think that the pinning to specific versions is not the best way forward though. There's an issue about this (I can't find it at the second) but we should be doing "pip freeze" and recording known good values with every release at minimum... but setup.py itself should not specify version numbers. I agree with the general sentiment, but it'll get us at the point where we never bother to update our packages, and/or packaging mediagoblin with distros will become very hard...

Anyway, merged and pushed! Great work, Sturm!

comment:8 by Christopher Allan Webber, 8 years ago

Milestone: 0.9.0
Note: See TracTickets for help on using tickets.