From ad4870e338497d12c0e3109ef1bbf81151d2c698 Mon Sep 17 00:00:00 2001 From: niphlod Date: Tue, 16 Apr 2013 20:50:24 +0200 Subject: [PATCH] windows-friendly coverage.ini, better handling for custom coverage settings, typo on contenttype.py --- .travis.yml | 4 ++-- gluon/contenttype.py | 2 +- gluon/tests/coverage.ini | 30 ++++++++++++++++++++++++++++++ gluon/widget.py | 9 +++++++-- 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 gluon/tests/coverage.ini diff --git a/.travis.yml b/.travis.yml index 859a9a27..4ee324e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,10 +29,10 @@ matrix: - python: 'pypy' env: DB=mysql://root:@localhost/test_w2p -script: export COVERAGE_PROCESS_START=gluon/tests/.coveragerc; ./web2py.py --run_system_tests --with_coverage +script: export COVERAGE_PROCESS_START=gluon/tests/coverage.ini; ./web2py.py --run_system_tests --with_coverage after_success: - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then coverage combine; fi - - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then coveralls --config_file=gluon/tests/.coveragerc; fi + - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then coveralls --config_file=gluon/tests/coverage.ini; fi notifications: email: true diff --git a/gluon/contenttype.py b/gluon/contenttype.py index c84ceb14..4c80480b 100644 --- a/gluon/contenttype.py +++ b/gluon/contenttype.py @@ -518,7 +518,7 @@ CONTENT_TYPE = { '.pln': 'application/x-planperfect', '.pls': 'audio/x-scpls', '.pm': 'application/x-perl', - '.png': 'image/x-apple-ios-png', + '.png': 'image/png', '.pnm': 'image/x-portable-anymap', '.pntg': 'image/x-macpaint', '.po': 'text/x-gettext-translation', diff --git a/gluon/tests/coverage.ini b/gluon/tests/coverage.ini new file mode 100644 index 00000000..f06c116d --- /dev/null +++ b/gluon/tests/coverage.ini @@ -0,0 +1,30 @@ +[run] +branch = True +parallel = True +source = gluon +## remove comment if you want applications coverage too +#source = gluon, applications + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code: + def __repr__ + if self\.debug + + # Don't complain if tests don't hit defensive assertion code: + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: + +ignore_errors = True +omit = gluon/contrib/* + +[html] +directory = coverage_html_report diff --git a/gluon/widget.py b/gluon/widget.py index 6e356abb..1eced339 100644 --- a/gluon/widget.py +++ b/gluon/widget.py @@ -78,7 +78,9 @@ def run_system_tests(options): if options.with_coverage: try: import coverage - coverage_config = os.path.join('gluon', 'tests', '.coveragerc') + coverage_config = os.environ.get("COVERAGE_PROCESS_START", + os.path.join('gluon', 'tests', 'coverage.ini') + ) call_args = ['coverage', 'run', '--rcfile=%s' % coverage_config, '-m', 'unittest', '-v', 'gluon.tests'] except: @@ -916,7 +918,10 @@ def console(): help=msg) msg = ('adds coverage reporting (needs --run_system_tests), ' - 'python 2.7 and the coverage module installed') + 'python 2.7 and the coverage module installed. ' + 'You can alter the default path setting the environmental ' + 'var "COVERAGE_PROCESS_START". ' + 'By default it takes gluon/tests/coverage.ini') parser.add_option('--with_coverage', action='store_true', dest='with_coverage',