-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Patrick Valsecchi
committed
Apr 26, 2017
1 parent
e660c88
commit b232122
Showing
13 changed files
with
106 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import coverage | ||
import logging | ||
import os | ||
import signal | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def init(): | ||
""" | ||
Maybe setup code coverage. | ||
""" | ||
if os.environ.get("COVERAGE", "0") != "1": | ||
return | ||
LOG.warning("Setting up code coverage") | ||
signal.signal(signal.SIGINT, signal_handler) | ||
report_dir = "/tmp/coverage/api" | ||
os.makedirs(report_dir, exist_ok=True) | ||
cov = coverage.Coverage(data_file=os.path.join(report_dir, 'coverage'), data_suffix=True, | ||
auto_data=True, branch=True, source=None) | ||
cov.start() | ||
|
||
|
||
def signal_handler(signal, frame): | ||
LOG.info("Caught signal, exiting...") | ||
exit(42) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
""" | ||
Module used by c2cwsgiutils_run.sh to provide a WSGI application when starting gunicorn | ||
""" | ||
from c2cwsgiutils import wsgi | ||
|
||
from c2cwsgiutils import wsgi, coverage_setup | ||
|
||
coverage_setup.init() | ||
application = wsgi.create_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python3 | ||
import coverage | ||
import shutil | ||
import sys | ||
|
||
|
||
def main(): | ||
sources = sys.argv[1:] | ||
report_dir = '/reports/coverage/api' | ||
dest_dir = '/tmp/coverage/api' | ||
shutil.rmtree(dest_dir, ignore_errors=True) | ||
shutil.copytree(report_dir, dest_dir) | ||
cov = coverage.Coverage(data_file='coverage', data_suffix=True, source=sources, branch=True) | ||
cov.combine([dest_dir], strict=True) | ||
cov.html_report(directory=dest_dir) | ||
cov.report() | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ requests==2.13.0 | |
SQLAlchemy==1.1.6 | ||
zope.interface==4.3.3 | ||
zope.sqlalchemy==0.7.7 | ||
coverage==4.3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters