Help with unittest2
d at davea.name
Thu Dec 13 16:54:55 CET 2012
On 12/13/2012 10:03 AM, Daniel Laird wrote:
> I am new to python and am stuck with python 2.6 (Ubuntu 10.04 and dont want to force switch to 2.7)
> I want to use assertListEqual and other new test functions.
> I do am import unittest2 as unittest
> The code does not fail but any use of the new functions results in:
> NameError: global name 'assertListEqual' is not defined
> What am I doing wrong?
> Do I need to change something else? The docs seem to imply what I have done is enough.
Where's your code? And the full traceback from the error? From what
you say, I can't imagine how it would work, so my mind assumes something
different. You should be able to demonstrate the problem with a two
line sample program. Pasted from a real test, not paraphrased.
You do know that you'll need
right? That's because you used
import unittest2 as unittest
from unittest2 import assertListEqual
You can tell what names are in the unittest namespace by doing a
dir(unittest). Although that's normally done interactively, it'll work
fine from your code, as long as you put it before the spot where the
More information about the Python-list