1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-08-17 00:20:42 +03:00

Add test coverage.

This commit is contained in:
Simon Sapin 2011-05-02 14:59:59 +02:00
parent 6dfa5fd8e4
commit 2270facee9
3 changed files with 19 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.pyc
*.egg-info
.coverage

View File

@ -1,3 +1,6 @@
test:
python2 -m weasy.tests
coverage:
python2 -m weasy.tests --cover

View File

@ -16,7 +16,21 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from weasy.tests import all
if __name__ == '__main__':
all.main()
if '--cover' in sys.argv:
sys.argv.remove('--cover') # Attest complains on unknown options
from coverage import coverage
cover = coverage()
cover.start()
all.main()
cover.stop()
cover.report([module for name, module in sys.modules.iteritems()
# Imported modules end up in sys.modules as None
# eg. sys.modules['weasy.css.cssutils'] == None
# Is it because of the Attest import hook?
if module and name.startswith('weasy')])
else:
all.main()