cmheisel / nose-xcover

Fork of nose.plugins.cover that enables XML output (for use with Hudson, e.g.)
MIT License
52 stars 17 forks source link

Cannot import xcover #1

Closed jammons closed 14 years ago

jammons commented 14 years ago

I'm trying to run this with Django nose test and I keep getting this error: jeff@jeff-linux:~/project$ ./manage.py test --with-coverage --cover-package=project --cover-tests --with-xunit --with-xcoverage app [08/Jan/2010 11:49:54] DEBUG: "DefaultPluginManager load plugin sqlalchemy = sqlalchemy.test.noseplugin:NoseSQLAlchemy" [08/Jan/2010 11:49:54] DEBUG: "DefaultPluginManager load plugin xcover = nosexcover:XCoverage" /usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/plugins/manager.py:369: RuntimeWarning: Unable to load plugin xcover = nosexcover:XCoverage: No module named nosexcover RuntimeWarning) [08/Jan/2010 11:49:54] DEBUG: "DefaultPluginManager load plugin EARLPlugin = rdflib_tools.EARLPlugin:EARLPlugin" [08/Jan/2010 11:49:54] INFO: "version: 2.4.0" [08/Jan/2010 11:49:54] DEBUG: "DefaultPluginManager load plugin sqlalchemy = sqlalchemy.test.noseplugin:NoseSQLAlchemy" [08/Jan/2010 11:49:54] DEBUG: "DefaultPluginManager load plugin xcover = nosexcover:XCoverage" [08/Jan/2010 11:49:54] DEBUG: "DefaultPluginManager load plugin EARLPlugin = rdflib_tools.EARLPlugin:EARLPlugin" Usage: ./manage.py test [options] [appname ...]

Runs the test suite for the specified applications, or the entire site if no apps are specified.

./manage.py: error: no such option: --with-xcoverage

If I remove the --with-xcoverage the test runs fine.

I installed this this package from a clone of the git repo. After I downloaded it I ran: sudo python setup.py install

Any ideas on this?

cmheisel commented 14 years ago

Jammons,

What version of nose and django_nose do you have installed?

Thanks,

Chris

jammons commented 14 years ago

It looks like nose-0.11.1-py2.6.egg is what i installed. I think I used easy_install on Ubuntu if I remember right.

bastih commented 14 years ago

It seems like setup.py does not install the nosexcover.py into sitepackages.

jammons commented 14 years ago

Yeah, I copied setup.py into the /usr/local/lib/python2.6/dist-packages/nosexcover-1.0-py2.6.egg folder, and it allowed me to run the tests. At the end I got this error though: Traceback (most recent call last): File "./manage.py", line 11, in execute_manager(settings) File "/usr/local/lib/python2.6/dist-packages/django/core/management/init.py", line 439, in execute_manager utility.execute() File "/usr/local/lib/python2.6/dist-packages/django/core/management/init.py", line 380, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(_args, _options.dict) File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 222, in execute output = self.handle(_args, _options) File "/usr/local/lib/python2.6/dist-packages/django_nose-0.0.3-py2.6.egg/django_nose/management/commands/test.py", line 42, in handle failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive) File "/usr/local/lib/python2.6/dist-packages/django_nose-0.0.3-py2.6.egg/django_nose/runner.py", line 69, in run_tests addplugins=[result_plugin]) File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/core.py", line 113, in init argv=argv, testRunner=testRunner, testLoader=testLoader) File "/usr/lib/python2.6/unittest.py", line 817, in init self.runTests() File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/core.py", line 192, in runTests result = self.testRunner.run(self.test) File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/core.py", line 63, in run result.printErrors() File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/result.py", line 88, in printErrors self.config.plugins.report(self.stream) File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/plugins/manager.py", line 82, in call return self.call(_arg, _kw) File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/plugins/manager.py", line 150, in simple result = meth(_arg, _kw) File "/usr/local/lib/python2.6/dist-packages/nosexcover-1.0-py2.6.egg/nosexcover.py", line 33, in report coverage._the_coverage.xml_report(morfs, outfile='coverage.xml') AttributeError: 'module' object has no attribute '_the_coverage'

Any ideas on that one?

-Jeff

bastih commented 14 years ago

It works for me when I put nosexcoverage.py into my sitepackages dir.

jammons commented 14 years ago

Did you put in it just /dist-packages/ or in dist-packages/nosexcover-1.0-px2.6.egg/ folder?

bastih commented 14 years ago

just dist-packages

jammons commented 14 years ago

Hmm... I copied it in there and it's still giving the same error for me.

Thanks for the suggestion though, I'm definitely closer now.

cmheisel commented 14 years ago

I just updated the setup.py script and the packaging -- it's updated on github and on pypi can you give 1.0.1 a try?

jammons commented 14 years ago

Thanks for the response.

I just pulled the repo from github again and I'm still seeing the latest update as Dec. 13th.

Getting it from pypi still looks like just 1.0: jeff@jeff-linux:~/Desktop$ sudo easy_install nose-xcover Processing nose-xcover Running setup.py -q bdist_egg --dist-dir /home/jeff/Desktop/nose-xcover/egg-dist-tmp-BkHZn6 warning: install_lib: 'build/lib.linux-i686-2.6' does not exist -- no Python modules to install nosexcover 1.0 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.6/dist-packages/nosexcover-1.0-py2.6.egg Processing dependencies for nosexcover==1.0 Finished processing dependencies for nosexcover==1.0

cmheisel commented 14 years ago

Jammons,

Hmm, can you try specifying 1.0.1 in your pip/easy_install?

jammons commented 14 years ago

OK, I deleted all mentions of nosexcover then easy_installed 1.0.1. It now loads fine, but it crashes again after the tests are run.

Traceback (most recent call last):
  File "./manage.py", line 11, in 
    execute_manager(settings)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 439, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 380, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/django_nose-0.0.3-py2.6.egg/django_nose/management/commands/test.py", line 42, in handle
    failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive)
  File "/usr/local/lib/python2.6/dist-packages/django_nose-0.0.3-py2.6.egg/django_nose/runner.py", line 69, in run_tests
    addplugins=[result_plugin])
  File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/core.py", line 113, in __init__
    argv=argv, testRunner=testRunner, testLoader=testLoader)
  File "/usr/lib/python2.6/unittest.py", line 817, in __init__
    self.runTests()
  File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/core.py", line 192, in runTests
    result = self.testRunner.run(self.test)
  File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/core.py", line 63, in run
    result.printErrors()
  File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/result.py", line 88, in printErrors
    self.config.plugins.report(self.stream)
  File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/plugins/manager.py", line 82, in __call__
    return self.call(*arg, **kw)
  File "/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg/nose/plugins/manager.py", line 150, in simple
    result = meth(*arg, **kw)
  File "/usr/local/lib/python2.6/dist-packages/nosexcover-1.0.1-py2.6.egg/nosexcover/nosexcover.py", line 33, in report
    coverage._the_coverage.xml_report(morfs, outfile='coverage.xml')
AttributeError: 'module' object has no attribute '_the_coverage'

Thanks, it's closer... -Jeff

cmheisel commented 14 years ago

Hrm, what version of coverage do you have installed?

jammons commented 14 years ago

coverage-2.58

Iker-Jimenez commented 14 years ago

I'm on the same version of coverage and getting the same error. It seems that the variable is called the_coverage instead of _the_coverage.

Lines 266 to 274 def visitGlobal(self, node):

"global" statements don't execute like others (they don't call the

        # trace function), so don't record their line numbers.
        pass
the_coverage = None

class CoverageException(Exception):
    pass
Iker-Jimenez commented 14 years ago

Ok, latest ubuntu 9.10 comes with version 2.85 of python-coverage that doesn't work with this plugin. I've just installed version 3.2 (latest at the moment) of coverage and it works fine. @cmheisel: It would be useful if you found out what minimum version of python coverage is required and add a comment about it. Maybe version 3.x? Otherwise thanks for writing the plugin.

cmheisel commented 14 years ago

Just pushed a new version to github (1.0.2) and i've got coverage pegged to 3.2 in the setup.py -- can you try installing this version. If it works I'll push it up to PyPI.

Thanks and sorry for all the trouble, this is my first nose plugin :-o

Chris

Iker-Jimenez commented 14 years ago

I cloned the repository and ran setup.py install from it and everything worked fine.

Then ran the tests and still working fine. Everything seems OK.

Cheers, Iker

cmheisel commented 14 years ago

Thanks for confirming!

jammons commented 14 years ago

Same here.

Thanks!