Opened 10 years ago

Closed 7 years ago

Last modified 7 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)

Subtickets

Attachments (1)

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

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by Elrond

Options:

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

comment:2 Changed 10 years ago by Elrond

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 Changed 10 years ago by Christopher Allan Webber

I did number 1!

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

comment:4 Changed 9 years ago by ShawnRisk

Keywords: test added

comment:5 Changed 9 years ago by Christopher Allan Webber

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 Changed 7 years ago by Ben Sturmfels

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.

Changed 7 years ago by Ben Sturmfels

Attachment: issue_665.patch added

comment:7 Changed 7 years ago by Christopher Allan Webber

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 Changed 7 years ago by Christopher Allan Webber

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