Please use "python -m coverage" instead of /usr/bin/coverage

Bug #1241332 reported by Thomas Goirand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Maxime Vidori

Bug Description

Horizon tries to use /usr/bin/coverage, which is available in RedHat, but isn't in Ubuntu and Debian (we have /usr/bin/python-coverage instead). It'd be nice if Horizon could either check for the existence of /usr/bin/python-coverage, or (more simply, as suggested by Robert Collins) use "python -m coverage" which will work everywhere.

(FYI: I'm writing about Horizon by memory, I hope I'm right and that's the only other package (except heat) which had the problem, pardon me if I'm wrong)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/52838

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress
Revision history for this message
Akihiro Motoki (amotoki) wrote :

"python -m coverage" seems not to work in python 2.6.
Any suggestion?

http://logs.openstack.org/38/52838/1/check/gate-horizon-python26/f2f9365/console.html#_2013-10-20_21_49_31_691

I will try python 2.6 in my debian note at home.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

I cannot take enough time to test with python 2.6. i will reset the status and the assignee to allow someone to work on it.

Changed in horizon:
status: In Progress → New
assignee: Akihiro Motoki (amotoki) → nobody
Revision history for this message
Matt Fischer (mfisch) wrote :

python -m coverage will not work on python 2.6 like you said and that means it wont work on Centos 6.4 or 6.5. Looking into alternatives.

Changed in horizon:
assignee: nobody → Matt Fischer (mfisch)
status: New → In Progress
Revision history for this message
Matt Fischer (mfisch) wrote :

This is what happens on Ubuntu when this is run outside the virt env:

mfisch@virgon:~/openstack/horizon$ ./run_tests.sh -c -N -P
Running Horizon application tests
./run_tests.sh: line 313: coverage: command not found
./run_tests.sh: line 314: coverage: command not found
Running openstack_dashboard tests
./run_tests.sh: line 323: coverage: command not found
Generating coverage reports
./run_tests.sh: line 329: coverage: command not found
./run_tests.sh: line 330: coverage: command not found
./run_tests.sh: line 331: coverage: command not found
Tests failed.

Revision history for this message
Matt Fischer (mfisch) wrote :

So it's not quite as simple as switching over to python-coverage as that seems to behave a bit differently:

mfisch@virgon:~/openstack/horizon (master)$ ./run_tests.sh -c -N -P
Running Horizon application tests
nosetests --verbosity 1 horizon --nocapture --nologcapture --exclude-dir=horizon/conf/ --exclude-dir=horizon/test/customization --cover-package=horizon --cover-inclusive --all-modules
Usage: manage.py [options]

manage.py: error: no such option: --exclude-dir

Anyone have other ideas?

Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

Hi Matt,

To make it work, you need python-nose-exclude, which I packaged in Debian:
http://packages.debian.org/sid/python-nose-exclude

Once you have it, the --exclude-dir error will go away. Then you'll have to do the python -m coverage thing. Though this will still not be enough to have all of the unit tests to work. I've spent hours on it, and it still didn't work correctly for me in Sid. Though this is orthogonal to fixing the coverage problem, so please go ahead!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/67517

Changed in horizon:
assignee: Matt Fischer (mfisch) → Maxime Vidori (maxime-vidori)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/67517
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=d2d2e5b6a197d2b5612c2942cd2eb965a3da3235
Submitter: Jenkins
Branch: master

commit d2d2e5b6a197d2b5612c2942cd2eb965a3da3235
Author: Maxime Vidori <email address hidden>
Date: Wed Apr 9 18:38:05 2014 +0200

    Use "python -m coverage" rather than use "coverage" explicitly

    When coverage module is installed using a package from Debian/Ubuntu,
    the command name is "python-coverage". By using "python -m coverage"
    the coverage module is detected in both cases.

    Change-Id: Icf9084855b83d0cc721de5325f38cf72ac85ff81
    Closes-Bug: #1241332
    Co-Authored-By: florent <email address hidden>

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.