ValueError: need more than 2 values to unpack

K

kahmed

When running nosetests i get error:

test_many_errors.test_value_two ... SKIP: (<type
'exceptions.ValueError'>, ValueError(), <traceback object at
0x1218cd8>)
test_many_errors.test_good_one ... ok
test_many_errors.test_good_two ... ok

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/Current/bin/
nosetests", line 10, in <module>
sys.exit(run_exit())
File "/Library/Frameworks/Python.framework/Versions/6.3/lib/
python2.6/site-packages/nose/core.py", line 117, in __init__
**extra_args)
File "/Library/Frameworks/Python.framework/Versions/6.3/lib/
python2.6/unittest.py", line 817, in __init__
self.runTests()
File "/Library/Frameworks/Python.framework/Versions/6.3/lib/
python2.6/site-packages/nose/core.py", line 196, in runTests
result = self.testRunner.run(self.test)
File "/Library/Frameworks/Python.framework/Versions/6.3/lib/
python2.6/site-packages/nose/core.py", line 63, in run
result.printErrors()
File "/Library/Frameworks/Python.framework/Versions/6.3/lib/
python2.6/site-packages/nosetrim-0.1.dev_r13-py2.6.egg/nosetrim/
nosetrim.py", line 136, in printErrors
lambda i: get_error_count(self._error_lookup, i))
File "/Library/Frameworks/Python.framework/Versions/6.3/lib/
python2.6/site-packages/nosetrim-0.1.dev_r13-py2.6.egg/nosetrim/
nosetrim.py", line 142, in printErrorList
for test, err, capt in errors:
ValueError: need more than 2 values to unpack
/

--------------------- >> end captured stdout << ----------------------

line 142 is:

"for test, err, capt in errors:"

Here is the code snippet:

def get_error_count(lookup, index):
if index in lookup:
ename = lookup[index]
return _errormap[ename]

self.printErrorList('ERROR', self.errors,
lambda i: get_error_count(self._error_lookup, i))
self.printErrorList('FAIL', self.failures,
lambda i: get_error_count(self._failure_lookup,
i))

def printErrorList(self, flavor, errors, get_error_count):
i = 0
for test, err, capt in errors:
self.stream.writeln(self.separator1)
self.stream.writeln("%s: %s" %
(flavor,self.getDescription(test)))
self.stream.writeln(self.separator2)
self.stream.writeln("%s" % err)
#count = get_error_count(i)
count = get_error_count(i)
if count > 1:
self.stream.writeln(self.separator2)
self.stream.writeln("+ %s more" % (count-1))
self.stream.writeln(self.separator2)
if capt is not None and len(capt):
self.stream.writeln(ln('>> begin captured stdout <<'))
self.stream.writeln(capt)
self.stream.writeln(ln('>> end captured stdout <<'))
i += 1


How do i resolve this ?

Thanks,
-Kamal.
 
J

John Nagle

line 142 is:

"for test, err, capt in errors:"

Somewhere in "errors" is a value that is not of length 3.

Try this to find out what's wrong:

for errorentry in errors :
try :
(test, err, capt) = errorentry # try to unpack
except ValueError as message : # unpack failed
raise(ValueError("%s: bogus entry in 'errors': %s" %
(message, repr(errorentry))))
...


John Nagle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top