Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

FIX assert_raises cannot be called with ``with\\ #1159

Merged
merged 1 commit into from Aug 28, 2012

Conversation

Projects
None yet
2 participants
Contributor

NelleV commented Aug 28, 2012

with assert_raises(ValueError):
something

does not work with nose 1.1.2 (raises a TypeError: TypeError: failUnlessRaises() takes at least 3 arguments (2 given))

This PR fixes some of the remaining failing tests on my machine (I still have some, but they seem more tricky to fix)

FIX assert_raises cannot be called with with
  - Fixed 5 tests failing
  - PEP8 compliance
Owner

mdboom commented Aug 28, 2012

Hmm... I'm running nose 1.1.2 as well, and I don't have a problem with this usage of assert_raises. Can you post the entire traceback?

Contributor

NelleV commented Aug 28, 2012

The difference is that I'm working with python2.6, and not python2.7. There are a couple of things that were introduced in python2.7 and not backported by nosetests to python2.6. assertIs is one of those. The usage of assert_raises with with is another. Here is the traceback:

ERROR: main.test_LogLocator

Traceback (most recent call last):
File "/home/nelle/Projets/matplotlib/matplotlib/py2.6/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "lib/matplotlib/tests/test_ticker.py", line 37, in test_LogLocator
with assert_raises(ValueError):
TypeError: failUnlessRaises() takes at least 3 arguments (2 given)

This test works fine with python2.7

Owner

mdboom commented Aug 28, 2012

I see. This seems like a very worthwhile fix, then.

mdboom added a commit that referenced this pull request Aug 28, 2012

Merge pull request #1159 from NelleV/FIX_tests
FIX assert_raises cannot be called with ``with\\

@mdboom mdboom merged commit 85e3d4b into matplotlib:master Aug 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment