add coverage

This commit is contained in:
clowwindy 2014-12-24 16:47:14 +08:00
parent 9cfffa360e
commit 1d0c8b1800
3 changed files with 30 additions and 1 deletions

View file

@ -60,4 +60,6 @@ rm -rf htmlcov
rm -rf tmp
coverage html --include=shadowsocks/*
coverage report --include=shadowsocks/* | tail -n1 | rev | cut -d' ' -f 1 | rev > /tmp/shadowsocks-coverage
exit $result

View file

@ -1,7 +1,9 @@
shadowsocks
===========
[![PyPI version]][PyPI] [![Build Status]][Travis CI]
[![PyPI version]][PyPI]
[![Build Status]][Travis CI]
[![Coverage Status]][Coverage]
A fast tunnel proxy that helps you bypass firewalls.
@ -119,6 +121,8 @@ Bugs and Issues
[Android]: https://github.com/clowwindy/shadowsocks/wiki/Ports-and-Clients#android
[Build Status]: https://img.shields.io/travis/clowwindy/shadowsocks/master.svg?style=flat
[Chinese Readme]: https://github.com/clowwindy/shadowsocks/wiki/Shadowsocks-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
[Coverage Status]: http://192.81.132.184/result/shadowsocks
[Coverage]: http://192.81.132.184/job/Shadowsocks/ws/htmlcov/index.html
[Debian sid]: https://packages.debian.org/unstable/python/shadowsocks
[the package]: https://pypi.python.org/pypi/shadowsocks
[Encryption]: https://github.com/clowwindy/shadowsocks/wiki/Encryption

23
tests/coverage_server.py Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
import urllib
class MainHandler(tornado.web.RequestHandler):
def get(self):
with open('/tmp/shadowsocks-coverage', 'rb') as f:
coverage = f.read().strip()
self.redirect(('https://img.shields.io/badge/'
'coverage-%s-brightgreen.svg'
'?style=flat') %
urllib.quote(coverage))
application = tornado.web.Application([
(r"/shadowsocks", MainHandler),
])
if __name__ == "__main__":
application.listen(8888, address='127.0.0.1')
tornado.ioloop.IOLoop.instance().start()