nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 395 forks source link

--with-xunit crash #1071

Open Quanalogy opened 6 years ago

Quanalogy commented 6 years ago

Hi.

I'm testing your --with-xunit in my jenkins pipeline. We have 30 targets that each run a couple of tests, and only one of them fails with the following error:

`` 15:48:17 [9:9-0] Traceback (most recent call last):

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/case.py", line 133, in run

15:48:17 [9:9-0] self.runTest(result)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/case.py", line 151, in runTest

15:48:17 [9:9-0] test(result)

15:48:17 [9:9-0] File "/usr/lib64/python3.6/unittest/case.py", line 670, in call

15:48:17 [9:9-0] return self.run(*args, **kwds)

15:48:17 [9:9-0] File "/usr/lib64/python3.6/unittest/case.py", line 638, in run

15:48:17 [9:9-0] result.addSuccess(self)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/proxy.py", line 164, in addSuccess

15:48:17 [9:9-0] self.plugins.addSuccess(self.test)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/plugins/manager.py", line 99, in call

15:48:17 [9:9-0] return self.call(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/plugins/manager.py", line 167, in simple

15:48:17 [9:9-0] result = meth(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/plugins/xunit.py", line 332, in addSuccess

15:48:17 [9:9-0] id = test.id()

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/case.py", line 85, in id

15:48:17 [9:9-0] return self.test.id()

15:48:17 [9:9-0] TypeError: 'int' object is not callable

15:48:17 [9:9-0]

15:48:17 [9:9-0] During handling of the above exception, another exception occurred:

15:48:17 [9:9-0]

15:48:17 [9:9-0] Traceback (most recent call last):

15:48:17 [9:9-0] File "/usr/bin/nosetests-3", line 11, in

15:48:17 [9:9-0] load_entry_point('nose==1.3.7', 'console_scripts', 'nosetests-3.6')()

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/core.py", line 121, in init

15:48:17 [9:9-0] **extra_args)

15:48:17 [9:9-0] File "/usr/lib64/python3.6/unittest/main.py", line 95, in init

15:48:17 [9:9-0] self.runTests()

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/core.py", line 207, in runTests

15:48:17 [9:9-0] result = self.testRunner.run(self.test)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/core.py", line 62, in run

15:48:17 [9:9-0] test(result)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/suite.py", line 177, in call

15:48:17 [9:9-0] return self.run(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/suite.py", line 224, in run

15:48:17 [9:9-0] test(orig)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/suite.py", line 177, in call

15:48:17 [9:9-0] return self.run(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/suite.py", line 224, in run

15:48:17 [9:9-0] test(orig)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/suite.py", line 177, in call

15:48:17 [9:9-0] return self.run(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/suite.py", line 224, in run

15:48:17 [9:9-0] test(orig)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/case.py", line 45, in call

15:48:17 [9:9-0] return self.run(*arg, **kwarg)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/case.py", line 138, in run

15:48:17 [9:9-0] result.addError(self, err)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/proxy.py", line 131, in addError

15:48:17 [9:9-0] plugins.addError(self.test, err)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/plugins/manager.py", line 99, in call

15:48:17 [9:9-0] return self.call(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/plugins/manager.py", line 167, in simple

15:48:17 [9:9-0] result = meth(*arg, **kw)

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/plugins/xunit.py", line 288, in addError

15:48:17 [9:9-0] id = test.id()

15:48:17 [9:9-0] File "/usr/lib/python3.6/site-packages/nose/case.py", line 85, in id

15:48:17 [9:9-0] return self.test.id()

15:48:17 [9:9-0] TypeError: 'int' object is not callable ``

Seems odd to me, as the test is passing and running the tests again produce the same results. A note for the prepended text to each line, it's formatted with timestamp [passed:total-failedtests], so several tests have already passed when this error happens.

gerph commented 6 years ago

That looks like the Test object that's being operated on contains an id field which contains an int rather than passing on to the method that generates its name. I'd expect that something about the way in which the particular test was operating or was invoked caused a different behaviour. Have you tried reducing the failure to a test case which one contains the failing test. It might be that the test in question is being invoked in a different way to the others. Is it a test function ? A part of a test class method ? Does it use generators to create tests ?