diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000000..00174e3e6c2a --- /dev/null +++ b/.coveragerc @@ -0,0 +1,9 @@ +[run] +source=matplotlib +[report] +omit = + matplotlib/tests/* + matplotlib/testing/* + +exclude_lines = + raise NotImplemented diff --git a/.gitignore b/.gitignore index b56c466ef4e3..dfc03898ba9d 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,10 @@ examples/tests/* texput.log texput.aux result_images + +# Coverage generated files # +############################ + +.coverage +.coverage.* +cover/ diff --git a/.travis.yml b/.travis.yml index 165ea984985d..8c1fbfd97011 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,8 @@ matrix: env: BUILD_DOCS=true install: - - pip install -q nose python-dateutil $NUMPY pep8 pyparsing pillow sphinx!=1.3.0 + - pip install python-dateutil $NUMPY pep8 pyparsing pillow sphinx!=1.3.0 coveralls coverage + - pip install --upgrade nose # We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not # availible in the Ubuntu version used by Travis but we can manually install the deb from a later @@ -66,7 +67,7 @@ install: cp Felipa-Regular.ttf ~/.fonts fc-cache -f -v fi; - - python setup.py install + - python setup.py install --single-version-externally-managed --record=/dev/null script: # The number of processes is hardcoded, because using too many causes the @@ -142,3 +143,10 @@ after_success: fi fi fi + if [[ $BUILD_DOCS == false && $TEST_ARGS != "--pep8" ]]; then + # account for us running the test out-of-repo and coveralls expects in-repo + # tests + mv cover .coverage ../matplotlib + cd ../matplotlib + coveralls + fi \ No newline at end of file diff --git a/tests.py b/tests.py index 620aeeaa4a38..551c9e1453b3 100755 --- a/tests.py +++ b/tests.py @@ -19,7 +19,7 @@ import nose from matplotlib.testing.noseclasses import KnownFailure from matplotlib import default_test_modules - +from nose.plugins.cover import Coverage from matplotlib import font_manager # Make sure the font caches are created before starting any possibly # parallel tests @@ -27,7 +27,12 @@ while not os.path.exists(font_manager._fmcache): time.sleep(0.5) +plugins = [KnownFailure, Coverage] + plugins = [KnownFailure] +env = {"NOSE_WITH_COVERAGE": 1, + 'NOSE_COVER_PACKAGE': 'matplotlib', + 'NOSE_COVER_HTML': 1} # Nose doesn't automatically instantiate all of the plugins in the # child processes, so we have to provide the multiprocess plugin with @@ -45,7 +50,8 @@ def run(): faulthandler.enable() nose.main(addplugins=[x() for x in plugins], - defaultTest=default_test_modules) + defaultTest=default_test_modules, + env=env) if __name__ == '__main__': if '--no-pep8' in sys.argv: