bobber6467 / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

NoneType error in manager.py #479

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a virtualenv like so:

mkvirtualenv nosebug
pip install nose
pip install sst

2. create a test.py like so:
from nose.plugins.attrib import attr                                            

from sst.actions import *                                                       

def method_that_will_fail():                                                    
    go_to("http://www.google.com")                                              
    click("blahblah")                                                           

@attr('positive')                                                               

class TestSomething(object):                                                    

    def test_navigating_from_chegg_to_link_and_back(self):                         
        for _ in range(0,1):                                                    
            yield self.something_to_test                                           

    def something_to_test(self):                                                
        method_that_will_fail()  

3. execute your tests using the following:

 nosetests --debug --with-xunit --with-freshen

What is the expected output? What do you see instead?

You'd expect to have the test run and fail because it couldn't click on 
'blahblah' but you get the strangest NoneType error in manager.py which I've 
worked around with a hack in the code. Here's the output you end up getting:

> nosetests --debug --with-xunit --with-freshen
Traceback (most recent call last):
  File "/home/rlgomes/.virtualenvs/nosetest/bin/nosetests", line 8, in <module>
    load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')()
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/core.py", line 118, in __init__
    **extra_args)
  File "/usr/lib/python2.7/unittest/main.py", line 95, in __init__
    self.runTests()
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/core.py", line 197, in runTests
    result = self.testRunner.run(self.test)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/core.py", line 61, in run
    test(result)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 176, in __call__
    return self.run(*arg, **kw)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 223, in run
    test(orig)
  File "/usr/lib/python2.7/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 74, in run
    test(result)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 176, in __call__
    return self.run(*arg, **kw)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 223, in run
    test(orig)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 176, in __call__
    return self.run(*arg, **kw)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/suite.py", line 223, in run
    test(orig)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/case.py", line 45, in __call__
    return self.run(*arg, **kwarg)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/case.py", line 138, in run
    result.addError(self, err)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/proxy.py", line 131, in addError
    formatted = plugins.formatError(self.test, err)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/plugins/manager.py", line 136, in chain
    result = meth(*arg, **kw)
  File "/home/rlgomes/.virtualenvs/nosetest/local/lib/python2.7/site-packages/nose/plugins/logcapture.py", line 226, in formatError
    ec, ev, tb = err
TypeError: 'NoneType' object is not iterable

I tracked the issue to the chain method in he manager.py, here:

125     def chain(self, *arg, **kw):                                            

126         """Call plugins in a chain, where the result of each plugin call is 

127         sent to the next plugin as input. The final output result is 
returned.  
128         """                                                                 

129         result = None                                                       

130         # extract the static arguments (if any) from arg so they can        

131         # be passed to each plugin call in the chain                        

132         static = [a for (static, a)                                         

133                   in zip(getattr(self.method, 'static_args', []), arg)      

134                   if static]                                                

135         for p, meth in self.plugins:                                        

136             result = meth(*arg, **kw)                                       

137             arg = static[:]                                                 

138             arg.append(result)                                              

139         return result     

the part where the arg = static[:] seems to end up doing something wrong and 
passing in a None argument :( I don't quite know what is being done with the 
chaining so I can't offer up a fix and worked around it by just skipping over 
the arg = xxx; and arg.append lines.

What version of the product are you using? On what operating system?

1.1.2 of nose on linux mint 13

Please provide any additional information below.

Original issue reported on code.google.com by rodneygo...@gmail.com on 4 Jun 2012 at 8:41