Open GoogleCodeExporter opened 8 years ago
0.10.3 is a very old version. Can you verify that this bug still exists in the
current code in mercurial?
Original comment by jpelle...@gmail.com
on 16 Oct 2009 at 2:04
AttributeError: 'ContextSuite' object has no attribute 'capturedOutput'
We were getting the same error when using the teamcity-nose and
teamcity-messages plugin. Using Python 2.6. Tested with the latest nose 1.0.0
on pypi, and tip at https://bitbucket.org/jpellerin/nose/ changeset 780:
6318b0c855a6
Get the error on both.
Fixed it a little differently than yanegomi. Patch attached. The code will
still pass through the error data to the teamcity plugin, so that the error
gets printed in the teamcity service message, and you will know what failed.
nat_linden kindly made a fork from nose tip, with the patch here:
https://bitbucket.org/nat_linden/nose/
thanks
automated.test.spider and nat_linden
Original comment by automate...@gmail.com
on 19 May 2011 at 10:46
Attachments:
whoops, this issue wasn't tagged with the patch so we lost track of it. Thanks
for updating the patch.
If you can add a test that reproduces the error then it would greatly speed up
getting the patch applied. There is info in DEVELOPERS.txt for how to run the
tests.
Original comment by kumar.mcmillan
on 21 May 2011 at 12:26
[deleted comment]
Thanks Kumar. I believe the issue occurs when you have a nose plugin using the
old plugin api (0.9) which goes through the ZeroNinePlugin code. The test
script has a setup function, rather than a method of a unittest.TestCase
subclass. If there is a failure during the setup function, the test object has
no capturedOutput attribute, nor does it have a test attribute (test.test).
I'll work on making a unit test case that simulates this condition.
If useful, here are some manual steps to reproduce:
1) Create a virtualenv
virtualenv --no-site-packages --distribute issue296
2) Pip install the teamcity-nose package, which will install the
teamcity-messages dependency, and nose. The TeamCity plugin is based on the
older nose plugin api.
issue296\Scripts\pip install teamcity-nose
3) I like to install and run yolk in my virtualenv, to verify the packages and
their versions (but this is not required for the test)
issue296\Scripts\pip install yolk
issue296\Scripts\yolk -l
4) Make sure that the TEAMCITY_PROJECT_NAME environment variable is set with
some value (any value). The teamcity-nose plugin checks for the environment
variable to determine whether it should be active.
SET TEAMCITY_PROJECT_NAME=foo
5) Create a python script with test case functions that have a setup function
that will fail. The setup and test case functions are NOT subclasses of
unittest.TestCase. I named it break.py.
# Test cases which are not subclasses of unittest.TestCase
# with a setup function which will raise an Exception
-----------------------------------
def setup():
raise RuntimeError('break setup')
def test_one():
print "testone"
def test_two():
print "testtwo"
---------------------------------
6) Run the test script file via nosetests without -s.
issue296\Scripts\nosetests issue296\break.py
##teamcity[testSuiteStarted name='break']
Traceback (most recent call last):
File "C:\natspider\issue296\Scripts\nosetests-script.py", line 9, in <module>
load_entry_point('nose==1.0.0', 'console_scripts', 'nosetests')()
File "C:\natspider\issue296\lib\site-packages\nose\core.py", line 118, in __init__
**extra_args)
File "C:\Python26\Lib\unittest.py", line 817, in __init__
self.runTests()
File "C:\natspider\issue296\lib\site-packages\nose\core.py", line 197, in runTests
result = self.testRunner.run(self.test)
File "C:\natspider\issue296\lib\site-packages\nose\core.py", line 61, in run
test(result)
File "C:\natspider\issue296\lib\site-packages\nose\suite.py", line 176, in __call__
return self.run(*arg, **kw)
File "C:\natspider\issue296\lib\site-packages\nose\suite.py", line 213, in run
result.addError(self, self._exc_info())
File "C:\natspider\issue296\lib\site-packages\nose\proxy.py", line 124, in addError
plugins.addError(self.test, err)
File "C:\natspider\issue296\lib\site-packages\nose\plugins\manager.py", line 94, in __call__
return self.call(*arg, **kw)
File "C:\natspider\issue296\lib\site-packages\nose\plugins\manager.py", line 162, in simple
result = meth(*arg, **kw)
File "C:\natspider\issue296\lib\site-packages\nose\plugins\manager.py", line 320, in addError
return self.plugin.addError(test.test, err, capt)
AttributeError: 'ContextSuite' object has no attribute 'test'
7) Run the test script file via nosetests with -s.
issue296\Scripts\nosetests issue296\break.py
##teamcity[testSuiteStarted name='break']
Traceback (most recent call last):
File "C:\natspider\issue296\Scripts\nosetests-script.py", line 9, in <module>
load_entry_point('nose==1.0.0', 'console_scripts', 'nosetests')()
File "C:\natspider\issue296\lib\site-packages\nose\core.py", line 118, in __init__
**extra_args)
File "C:\Python26\Lib\unittest.py", line 817, in __init__
self.runTests()
File "C:\natspider\issue296\lib\site-packages\nose\core.py", line 197, in runTests
result = self.testRunner.run(self.test)
File "C:\natspider\issue296\lib\site-packages\nose\core.py", line 61, in run
test(result)
File "C:\natspider\issue296\lib\site-packages\nose\suite.py", line 176, in __call__
return self.run(*arg, **kw)
File "C:\natspider\issue296\lib\site-packages\nose\suite.py", line 213, in run
result.addError(self, self._exc_info())
File "C:\natspider\issue296\lib\site-packages\nose\proxy.py", line 124, in addError
plugins.addError(self.test, err)
File "C:\natspider\issue296\lib\site-packages\nose\plugins\manager.py", line 94, in __call__
return self.call(*arg, **kw)
File "C:\natspider\issue296\lib\site-packages\nose\plugins\manager.py", line 162, in simple
result = meth(*arg, **kw)
File "C:\natspider\issue296\lib\site-packages\nose\plugins\manager.py", line 319, in addError
capt = test.capturedOutput
AttributeError: 'ContextSuite' object has no attribute 'capturedOutput'
Original comment by automate...@gmail.com
on 25 May 2011 at 7:57
Original issue reported on code.google.com by
yaneg...@gmail.com
on 16 Oct 2009 at 10:47Attachments: