ValueError: need more than 2 values to unpack

kahmed kamal2222ahmed at gmail.com
Fri Apr 1 10:48:20 EDT 2011


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.



More information about the Python-list mailing list