Cannot use pyzen with nosetests in a django app
sharebear opened this issue · 10 comments
Hi,
I just tried starting a new django project using django-nose together with pyzen however python manage.py zen just crashes with the following exception
$ python myproject/manage.py zen
nosetests --verbosity 1
Traceback (most recent call last):
File "/Users/jshare/Source/myproject/env/lib/python2.6/site-packages/pyzen/core.py", line 79, in run
result = self.func(_self.args, *_self.kwargs)
File "/Users/jshare/Source/myproject/env/lib/python2.6/site-packages/pyzen/management/commands/zen.py", line 32, in run_tests
result = test_runner.run_tests(test_labels)
File "/Users/jshare/Source/myproject/env/lib/python2.6/site-packages/django_nose/runner.py", line 85, in run_tests
result = self.run_suite(nose_argv)
File "/Users/jshare/Source/myproject/env/lib/python2.6/site-packages/pyzen/management/commands/zen.py", line 27, in run_suite
return get_test_runner(nocolor)(verbosity=self.verbosity).run(suite)
File "/Users/jshare/Source/myproject/env/lib/python2.6/site-packages/pyzen/runner.py", line 54, in run
test(result)
TypeError: 'list' object is not callable
Looking at the code for the zen command implementation I can see that this unlikely to work with the current implementation as you end up overriding the run_suite method from NoseTestSuiteRunner https://github.com/jbalogh/django-nose/blob/master/django_nose/runner.py
It's a little late in the day here so I'm struggling to see a way to get these two runners to play together. Any ideas on how I could get this dream setup to work?
Regards,
Jonathan
Hmm, so I could change it so that --nocolor uses the super-classes test runner I think (the runner it injects just adds color coding). Not sure if there was a specific reason I had to not use the normal Django runner.
Really the better answer is that django-nose shouldn't alter the semantics of run_suite :-(
I've read the documentation of run_suite and I don't see how django-nose is changing the semantics. It feels more to me that pyzen is making an invalid assumption.
From what I can tell pyzen is only overriding the test runner in order to add the colourising so you could just skip the overriding if nocolor is specified. Would this solve my problem?
The change in semantics is that the thing django-nose passes to run_suite isn't actually a suite. As for the solution, I think that would work fine in 1.3+ (DjangoTestRunner had some signal stuffs I had to avoid in 1.2 I think). I'll go ahead an add a new option just to be safe.
has this option been added somewhere? I don't see it in the commits.
i'd love it to work too :) +1
this is still broken on my side, any workaround to this in the meantime ?
Just updated django-nose to 1.0. Give it another shot?
I just did a quick test and I get the same error "TypeError: 'list' object is not callable"
Also encountering this issue w/:
Django==1.4
PyZen==0.3.2
nose==1.1.2
django-nose==1.1
coverage==3.5.2
specloud==0.4.5
nose-cover3==0.1.0