From 17ae8c9cb68e52520dc8750aa8a94cbdf2493f30 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 22 Apr 2015 01:26:10 -0400 Subject: [PATCH 1/8] TST : enable coveralls - also update nose --- .coveragerc | 10 ++++++++++ .travis.yml | 4 +++- tests.py | 10 ++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000000..c4477f170148 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,10 @@ +[run] +source=matplotlib +[report] +omit = + */python?.?/* + */site-packages/nose/* + *test* + +exclude_lines = + raise NotImplemented diff --git a/.travis.yml b/.travis.yml index 165ea984985d..9a212129424b 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 @@ -142,3 +143,4 @@ after_success: fi fi fi + coveralls \ 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: From 983e1beea06a8591d9a239a0f1f7d45439f72042 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 13:32:28 -0400 Subject: [PATCH 2/8] TST : move coverage output where coveralls expects We run tests out-of-repo which is to ensure that we pick up the installed version of mpl, not version which happens to be in the current directory (but I am not sure we strictly need this any more now that absolute imports are a thing). The coveralls scripts assume that you are running your tests _in_ the repo and are trying to extract git information from the directory they are run in, hence are failing for everything but the doc builds (which don't run nose so have no coverage). This exclude the doc build from uploading to coveralls and moves the cover output to be where coveralls expects it to be (and cds back into the repo). --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9a212129424b..1a8b0643470c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -143,4 +143,10 @@ after_success: fi fi fi - coveralls \ No newline at end of file + if [[ $BUILD_DOCS == false ]]; 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 From 96a778aa098445072b3fffa015c1fbc1780086a7 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 14:25:28 -0400 Subject: [PATCH 3/8] MNT : add coverage output to .gitignore --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) 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/ From d9752432aadef7ae08098ced48aa527622493770 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 14:00:35 -0400 Subject: [PATCH 4/8] TST : don't upload pep8 test to coveralls --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1a8b0643470c..800177bbfc18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -143,7 +143,7 @@ after_success: fi fi fi - if [[ $BUILD_DOCS == false ]]; then + 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 From 649702c4ccce0281e635cbdaff9edfabd5aab47c Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 15:19:12 -0400 Subject: [PATCH 5/8] TST : tweak cover report filters --- .coveragerc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.coveragerc b/.coveragerc index c4477f170148..91a75b3541f8 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,10 +1,6 @@ [run] source=matplotlib [report] -omit = - */python?.?/* - */site-packages/nose/* - *test* exclude_lines = raise NotImplemented From 1a93e9d2f0e55f966986a2ddbe072e00be04534e Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 15:37:46 -0400 Subject: [PATCH 6/8] TST : don't report coverage on testing code --- .coveragerc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.coveragerc b/.coveragerc index 91a75b3541f8..00174e3e6c2a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,9 @@ [run] source=matplotlib [report] +omit = + matplotlib/tests/* + matplotlib/testing/* exclude_lines = raise NotImplemented From 762a3bb45a0a13283073cd8cd34bff9be8ea8271 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 15:41:31 -0400 Subject: [PATCH 7/8] TST : do not create an egg during installation --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 800177bbfc18..e97e9f41cada 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,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=record_junk.txt script: # The number of processes is hardcoded, because using too many causes the From 52dd5bfce33988bc0136a9b3e47a6c639ddcef21 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 3 May 2015 16:42:31 -0400 Subject: [PATCH 8/8] TST : send the record information to the void --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e97e9f41cada..8c1fbfd97011 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ install: cp Felipa-Regular.ttf ~/.fonts fc-cache -f -v fi; - - python setup.py install --single-version-externally-managed --record=record_junk.txt + - python setup.py install --single-version-externally-managed --record=/dev/null script: # The number of processes is hardcoded, because using too many causes the