mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-09-11 12:46:15 +03:00
Add test coverage.
This commit is contained in:
parent
6dfa5fd8e4
commit
2270facee9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
.coverage
|
||||||
|
3
Makefile
3
Makefile
@ -1,3 +1,6 @@
|
|||||||
test:
|
test:
|
||||||
python2 -m weasy.tests
|
python2 -m weasy.tests
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
python2 -m weasy.tests --cover
|
||||||
|
|
||||||
|
@ -16,7 +16,21 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sys
|
||||||
from weasy.tests import all
|
from weasy.tests import all
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user