unbound method run() must be called with TextTestRunner

205 views
Skip to first unread message

xgnata

unread,
Jun 27, 2009, 8:22:37 AM6/27/09
to nose-users
Hi all,

python-nose is fully broken in ubuntu karmic alpha 2 and I'm not able
to understand why.
For instance, when I tun the testsuite from numpy, I get that:

/usr/local/src/numpy# nosetests
Traceback (most recent call last):
File "/usr/bin/nosetests", line 8, in <module>
load_entry_point('nose==0.10.4', 'console_scripts', 'nosetests')()
File "/usr/lib/pymodules/python2.6/nose/core.py", line 219, in
__init__
argv=argv, testRunner=testRunner, testLoader=testLoader)
File "/usr/lib/python2.6/unittest.py", line 819, in __init__
self.runTests()
File "/usr/lib/pymodules/python2.6/nose/core.py", line 298, in
runTests
result = self.testRunner.run(self.test)
TypeError: unbound method run() must be called with TextTestRunner
instance as first argument (got ContextSuite instance instead)

I have no real clue why so far :(
https://bugs.launchpad.net/ubuntu/+source/nose/+bug/389942


Regards,
Xavier

Garrett Cooper

unread,
Jun 27, 2009, 10:08:24 PM6/27/09
to nose-...@googlegroups.com, nose-users
Sent from my iPhone

I'll have to check, but it may be a bug with python 2.6 or unittest.

Hth,
-Garrett

Xavier Gnata

unread,
Jun 28, 2009, 7:05:43 AM6/28/09
to nose-...@googlegroups.com
Well if I diff unittest from python2.5 and unittest from python2.6 I see
that:
@@ -800,9 +851,16 @@
self.module)

def runTests(self):
- if self.testRunner is None:
- self.testRunner = TextTestRunner(verbosity=self.verbosity)
- result = self.testRunner.run(self.test)
+ if isinstance(self.testRunner, (type, types.ClassType)):
+ try:
+ testRunner = self.testRunner(verbosity=self.verbosity)
+ except TypeError:
+ # didn't accept the verbosity argument
+ testRunner = self.testRunner()
+ else:
+ # it is assumed to be a TestRunner instance
+ testRunner = self.testRunner
+ result = testRunner.run(self.test)
sys.exit(not result.wasSuccessful())

main = TestProgram

which could explain the problem...

Xavier

jason pellerin

unread,
Jun 29, 2009, 10:08:01 AM6/29/09
to nose-...@googlegroups.com
Sorry I didn't see this thread until now. I can't explain this; nose
0.10.4 works fine with python 2.6. nose overrides
TestProgram.runTests, so the changes to unittest quoted below don't
matter. It does appear from the error that something is causing a
TestRunner class to be passed in instead of a TestRunner instance, but
nothing in nose proper is doing that. I suggest taking this up with
the maintainer of the ubuntu package.

Sorry I can't be more help.

JP

Xavier Gnata

unread,
Jun 29, 2009, 2:14:34 PM6/29/09
to nose-...@googlegroups.com
Ok. Here it is : https://bugs.launchpad.net/ubuntu/+source/nose/+bug/389942
I have no clue what the problem could be.
A bug in Python 2.6.2+ from ubuntu is quite unlikely.
*no clue*

XG

Darren Dale

unread,
Jun 29, 2009, 2:59:08 PM6/29/09
to nose-users
Actually, a bug related to ubuntu/debian's new python policy is not
completely unlikely. They have patched python to install to dist-
packages instead of site-packages, manually installed packages
(outside of the package manager) go into /usr/local/[...]/dist-
packages. This change lead to problems with ubuntu's own packaging of
pyqwt, for example. I took a wild guess that it had something to do
with pkg_rsources on ubuntu, but that is nothing more than a wild
guess.

Darren

On Jun 29, 2:14 pm, Xavier Gnata <xavier.gn...@gmail.com> wrote:
> Ok. Here it is :https://bugs.launchpad.net/ubuntu/+source/nose/+bug/389942
> I have no clue what the problem could be.
> A bug in Python 2.6.2+ from ubuntu is quite unlikely.
> *no clue*
>
> XG
>
> > Sorry I didn't see this thread until now. I can't explain this; nose
> > 0.10.4 works fine with python 2.6. nose overrides
> > TestProgram.runTests, so the changes to unittest quoted below don't
> > matter. It does appear from the error that something is causing a
> > TestRunner class to be passed in instead of a TestRunner instance, but
> > nothing in nose proper is doing that. I suggest taking this up with
> > the maintainer of the ubuntu package.
>
> > Sorry I can't be more help.
>
> > JP
>
> > On Sun, Jun 28, 2009 at 7:05 AM, Xavier Gnata<xavier.gn...@gmail.com> wrote:
>
> >> Garrett Cooper wrote:
>
> >>> Sent from my iPhone
>

Xavier Gnata

unread,
Jul 1, 2009, 3:10:13 PM7/1/09
to nose-...@googlegroups.com
Ok. Is there anything I could check to try solve that?
I have trace all the functions calls down to the error but I have no
working python-nose to compare with. As a result, I was not able to
understand where the problem is :(

Xavier

cav71

unread,
Jul 6, 2009, 6:38:23 PM7/6/09
to nose-users
Hi,
have you tried to change in nose/core.py around line 194 (in
TestProgram.runTests):

result = self.testRunner.run(self.test)
change into
result = self.testRunner().run(self.test)

Regards,
Antonio



On Jun 27, 1:22 pm, xgnata <xavier.gn...@gmail.com> wrote:
> Hi all,
>
> python-nose is fully broken in ubuntu karmic alpha 2 and I'm not able
> to understand why.
> For instance, when I tun the testsuite from numpy, I get that:
>
> /usr/local/src/numpy# nosetests
> Traceback (most recent call last):
>   File "/usr/bin/nosetests", line 8, in <module>
>     load_entry_point('nose==0.10.4', 'console_scripts', 'nosetests')()
>   File "/usr/lib/pymodules/python2.6/nose/core.py", line 219, in
> __init__
>     argv=argv, testRunner=testRunner, testLoader=testLoader)
>   File "/usr/lib/python2.6/unittest.py", line 819, in __init__
>     self.runTests()
>   File "/usr/lib/pymodules/python2.6/nose/core.py", line 298, in
> runTests
>     result = self.testRunner.run(self.test)
> TypeError:unboundmethod run() must be called with TextTestRunner

Xavier Gnata

unread,
Jul 6, 2009, 7:45:20 PM7/6/09
to nose-...@googlegroups.com
Hi,

It does work with python2.6.3 but its fails with 2.5 (in fact, with
python <2.6.3):
Traceback (most recent call last):
File "/usr/bin/nosetests", line 8, in <module>
load_entry_point('nose==0.10.4', 'console_scripts', 'nosetests')()
File "/usr/lib/pymodules/python2.5/nose/core.py", line 219, in __init__
argv=argv, testRunner=testRunner, testLoader=testLoader)
File "/usr/lib/python2.5/unittest.py", line 768, in __init__
self.runTests()
File "/usr/lib/pymodules/python2.5/nose/core.py", line 298, in runTests
result = self.testRunner().run(self.test)
TypeError: 'TextTestRunner' object is not callable

The semantics of 'TextTestRunner' has been modified in python-2.6.3
It is ugly but python-nose would have to test if python version is >=2.6.3


Xavier

Xavier Gnata

unread,
Jul 18, 2009, 9:34:45 AM7/18/09
to nose-...@googlegroups.com

http://bugs.launchpad.net/bugs/389942

I dont konw where the bug is...python? nose? both?
Anyhow, it is still there :(

Xavier

Reply all
Reply to author
Forward
0 new messages