You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(5) |
2
(4) |
3
(2) |
4
(4) |
5
(2) |
6
(32) |
7
(34) |
8
(19) |
9
(6) |
10
(7) |
11
(14) |
12
(1) |
13
(2) |
14
(8) |
15
(5) |
16
(5) |
17
(8) |
18
(8) |
19
(6) |
20
(9) |
21
(12) |
22
(1) |
23
(2) |
24
(8) |
25
(2) |
26
(1) |
27
(2) |
28
(3) |
29
|
30
(2) |
|
|
|
Revision: 7660 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7660&view=rev Author: astraw Date: 2009年09月06日 20:13:36 +0000 (2009年9月06日) Log Message: ----------- docs: describe how to run tests Modified Paths: -------------- trunk/matplotlib/doc/devel/coding_guide.rst Modified: trunk/matplotlib/doc/devel/coding_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/coding_guide.rst 2009年09月06日 20:13:06 UTC (rev 7659) +++ trunk/matplotlib/doc/devel/coding_guide.rst 2009年09月06日 20:13:36 UTC (rev 7660) @@ -683,7 +683,15 @@ .. _nose: http://somethingaboutorange.com/mrl/projects/nose/ +Running the tests +----------------- +Running the tests is simple. Make sure you have nose installed and +type from within Python:: + + import matplotlib + matplotlib.test() + Writing a simple test --------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7659 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7659&view=rev Author: astraw Date: 2009年09月06日 20:13:06 +0000 (2009年9月06日) Log Message: ----------- testing: add matplotlib.test() function to run tests Modified Paths: -------------- trunk/matplotlib/doc/devel/coding_guide.rst trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/test/run-mpl-test.py Modified: trunk/matplotlib/doc/devel/coding_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/coding_guide.rst 2009年09月06日 19:29:45 UTC (rev 7658) +++ trunk/matplotlib/doc/devel/coding_guide.rst 2009年09月06日 20:13:06 UTC (rev 7659) @@ -774,10 +774,6 @@ ----------------------------------------- Let's say you've added a new module named -``matplotlib.tests.test_whizbang_features``. For the buildbot slave -machines to know to run a test, nose must look in that module. To add -a module to the list searched, add the line:: - - args.append('matplotlib.tests.test_whizbang_features') - -into :file:`test/run-mpl-test.py`. +``matplotlib.tests.test_whizbang_features``. To add this module to +the list of default tests, append its name to ``default_test_modules`` +in :file:`lib/matplotlib/__init__.py`. Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2009年09月06日 19:29:45 UTC (rev 7658) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2009年09月06日 20:13:06 UTC (rev 7659) @@ -876,7 +876,33 @@ pass # we don't want to assume all -d flags are backends, eg -debug +default_test_modules = [ + 'matplotlib.tests.test_basic', + 'matplotlib.tests.test_transforms', + 'matplotlib.tests.test_spines', + ] +def test(verbosity=0): + """run the matplotlib test suite""" + import nose + import nose.plugins.builtin + from testing.noseclasses import KnownFailure + from nose.plugins.manager import PluginManager + + plugins = [] + plugins.append( KnownFailure() ) + plugins.extend( [plugin() for plugin in nose.plugins.builtin.plugins] ) + + manager = PluginManager(plugins=plugins) + config = nose.config.Config(verbosity=verbosity, plugins=manager) + + success = nose.run( defaultTest=default_test_modules, + config=config, + ) + return success + +test.__test__ = False # nose: this function is not a test + verbose.report('matplotlib version %s'%__version__) verbose.report('verbose.level %s'%verbose.level) verbose.report('interactive is %s'%rcParams['interactive']) Modified: trunk/matplotlib/test/run-mpl-test.py =================================================================== --- trunk/matplotlib/test/run-mpl-test.py 2009年09月06日 19:29:45 UTC (rev 7658) +++ trunk/matplotlib/test/run-mpl-test.py 2009年09月06日 20:13:06 UTC (rev 7659) @@ -44,6 +44,7 @@ import nose from mplTest import MplNosePlugin, path_utils +import matplotlib from matplotlib.testing.noseclasses import KnownFailure if '--clean' in args: @@ -91,9 +92,8 @@ ### Run nose args.append('.') -args.append('matplotlib.tests.test_basic') -args.append('matplotlib.tests.test_transforms') -args.append('matplotlib.tests.test_spines') +args.extend( matplotlib.default_test_modules ) + success = nose.run( argv = args, plugins = [ MplNosePlugin(), KnownFailure() ] ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7658 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7658&view=rev Author: astraw Date: 2009年09月06日 19:29:45 +0000 (2009年9月06日) Log Message: ----------- testing: remove leftover files from past image comparison failures Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/compare.py Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 12:16:41 UTC (rev 7657) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 19:29:45 UTC (rev 7658) @@ -114,15 +114,21 @@ h2 = actualImage.histogram() rms = math.sqrt( reduce(operator.add, map(lambda a,b: (a-b)**2, h1, h2)) / len(h1) ) + diff_image = os.path.join(os.path.dirname(actual), + 'failed-diff-'+os.path.basename(actual)) + expected_copy = 'expected-'+os.path.basename(actual) + if ( (rms / 10000.0) <= tol ): + if os.path.exists(diff_image): + os.unlink(diff_image) + if os.path.exists(expected_copy): + os.unlink(expected_copy) return None - diff_image = os.path.join(os.path.dirname(actual), - 'failed-diff-'+os.path.basename(actual)) save_diff_image( expected, actual, diff_image ) if in_decorator: - shutil.copyfile( expected, 'expected-'+os.path.basename(actual)) + shutil.copyfile( expected, expected_copy ) results = dict( rms = rms, expected = str(expected), @@ -131,6 +137,9 @@ ) return results else: + # expected_copy is only for in_decorator case + if os.path.exists(expected_copy): + os.unlink(expected_copy) # old-style call from mplTest directory msg = " Error: Image files did not match.\n" \ " RMS Value: " + str( rms / 10000.0 ) + "\n" \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7657 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7657&view=rev Author: jdh2358 Date: 2009年09月06日 12:16:41 +0000 (2009年9月06日) Log Message: ----------- add dyld to mac osx file Modified Paths: -------------- trunk/matplotlib/make.osx Modified: trunk/matplotlib/make.osx =================================================================== --- trunk/matplotlib/make.osx 2009年09月06日 07:11:57 UTC (rev 7656) +++ trunk/matplotlib/make.osx 2009年09月06日 12:16:41 UTC (rev 7657) @@ -76,6 +76,8 @@ export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\ export CFLAGS=${CFLAGS_DEPS} &&\ export LDFLAGS=${LDFLAGS_DEPS} &&\ + export LD_LIBRARY_PATH=${PREFIX}/lib &&\ + export DYLD_LIBRARY_PATH=${PREFIX}/lib &&\ python setup.py build mpl_install: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7656 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7656&view=rev Author: jouni Date: 2009年09月06日 07:11:57 +0000 (2009年9月06日) Log Message: ----------- Merged revisions 7638 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7638 | astraw | 2009年09月06日 02:20:45 +0300 (Su, 06 Syy 2009) | 4 lines spines: fix 'axes' position bug (closes SF#2852168) Thanks to Jason Grout for reporting this. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/spines.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_99_maint:1-7633 /branches/v0_98_5_maint:1-7253 + /branches/v0_99_maint:1-7633,7638 /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444,7446,7475-7482,7484,7486,7489-7523,7567,7569,7582-7584,7616-7618,7633,7638 Modified: trunk/matplotlib/lib/matplotlib/spines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/spines.py 2009年09月06日 05:19:47 UTC (rev 7655) +++ trunk/matplotlib/lib/matplotlib/spines.py 2009年09月06日 07:11:57 UTC (rev 7656) @@ -172,10 +172,14 @@ elif position_type=='axes': if self.spine_type in ('left','right'): self._spine_transform = ('pre', - mtransforms.Affine2D().translate(amount, 0.0)) + mtransforms.Affine2D.from_values( + # keep y unchanged, fix x at amount + 0,0,0,1,amount,0)) elif self.spine_type in ('bottom','top'): self._spine_transform = ('pre', - mtransforms.Affine2D().translate(0.0, amount)) + mtransforms.Affine2D.from_values( + # keep x unchanged, fix y at amount + 1,0,0,0,0,amount)) else: warnings.warn('unknown spine type "%s": no spine ' 'offset performed'%self.spine_type) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7655 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7655&view=rev Author: astraw Date: 2009年09月06日 05:19:47 +0000 (2009年9月06日) Log Message: ----------- buildbot: run tests in verbose mode on Mac Modified Paths: -------------- trunk/matplotlib/test/_buildbot_mac_sage.sh Modified: trunk/matplotlib/test/_buildbot_mac_sage.sh =================================================================== --- trunk/matplotlib/test/_buildbot_mac_sage.sh 2009年09月06日 05:05:57 UTC (rev 7654) +++ trunk/matplotlib/test/_buildbot_mac_sage.sh 2009年09月06日 05:19:47 UTC (rev 7655) @@ -11,4 +11,4 @@ make -f make.osx mpl_install echo ${PYTHONPATH} -cd test && python run-mpl-test.py --all --keep-failed \ No newline at end of file +cd test && python run-mpl-test.py --verbose --all --keep-failed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7654 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7654&view=rev Author: astraw Date: 2009年09月06日 05:05:57 +0000 (2009年9月06日) Log Message: ----------- docs: describe how to write tests Modified Paths: -------------- trunk/matplotlib/doc/devel/coding_guide.rst trunk/matplotlib/lib/matplotlib/testing/decorators.py Modified: trunk/matplotlib/doc/devel/coding_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/coding_guide.rst 2009年09月06日 03:39:42 UTC (rev 7653) +++ trunk/matplotlib/doc/devel/coding_guide.rst 2009年09月06日 05:05:57 UTC (rev 7654) @@ -561,9 +561,8 @@ -.. _license-discussion: +.. _sample-data: - Writing examples ================ @@ -602,6 +601,9 @@ print 'datafile', datafile +.. _license-discussion: + + Licenses ======== @@ -669,4 +671,113 @@ extensions for scientific computing: ipython, numpy, scipy, the enthought tool suite and python itself are all distributed under BSD compatible licenses. -> \ No newline at end of file + +Testing +======= + +Matplotlib has a testing infrastructure based on nose_, making it easy +to write new tests. The tests are in :mod:`matplotlib.tests`, and +customizations to the nose testing infrastructure are in +:mod:`matplotlib.testing`. (There is other old testing cruft around, +please ignore it while we consolidate our testing to these locations.) + +.. _nose: http://somethingaboutorange.com/mrl/projects/nose/ + + +Writing a simple test +--------------------- + +Many elements of Matplotlib can be tested using standard tests. For +example, here is a test from :mod:`matplotlib.tests.test_basic`:: + + from nose.tools import assert_equal + + def test_simple(): + '''very simple example test''' + assert_equal(1+1,2) + +Nose determines which functions are tests by searching for functions +beginning with "test" in their name. + +Writing an image comparison test +-------------------------------- + +Writing an image based test is only slightly more difficult than a +simple test. The main consideration is that you must specify the +"baseline", or expected, images in the +:func:`~matplotlib.testing.decorators.image_comparison` decorator. For +example, this test generates a single image and automatically tests +it:: + + import numpy as np + import matplotlib + matplotlib.use('Agg') + from matplotlib.testing.decorators import image_comparison + import matplotlib.pyplot as plt + + @image_comparison(baseline_images=['spines_axes_positions.png']) + def test_spines_axes_positions(): + # SF bug 2852168 + fig = plt.figure() + x = np.linspace(0,2*np.pi,100) + y = 2*np.sin(x) + ax = fig.add_subplot(1,1,1) + ax.set_title('centered spines') + ax.plot(x,y) + ax.spines['right'].set_position(('axes',0.1)) + ax.yaxis.set_ticks_position('right') + ax.spines['top'].set_position(('axes',0.25)) + ax.xaxis.set_ticks_position('top') + ax.spines['left'].set_color('none') + ax.spines['bottom'].set_color('none') + fig.savefig('spines_axes_positions.png') + +The mechanism for comparing images is extremely simple -- it compares +an image saved in the current directory with one from the Matplotlib +sample_data repository. The correspondence is done by matching +filenames, so ensure that: + + * The filename given to :meth:`~matplotlib.figure.Figure.savefig` is + exactly the same as the filename given to + :func:`~matplotlib.testing.decorators.image_comparison` in the + ``baseline_images`` argument. + + * The correct image gets added to the sample_data respository with + the name ``test_baseline_<IMAGE_FILENAME.png>``. (See + :ref:`sample-data` above for a description of how to add files to + the sample_data repository.) + + +Known failing tests +------------------- + +If you're writing a test, you may mark it as a known failing test with +the :func:`~matplotlib.testing.decorators.knownfailureif` +decorator. This allows the test to be added to the test suite and run +on the buildbots without causing undue alarm. For example, although +the following test will fail, it is an expected failure:: + + from nose.tools import assert_equal + from matplotlib.testing.decorators import knownfailureif + + @knownfailureif(True) + def test_simple_fail(): + '''very simple example test that should fail''' + assert_equal(1+1,3) + +Note that the first argument to the +:func:`~matplotlib.testing.decorators.knownfailureif` decorator is a +fail condition, which can be a value such as True, False, or +'indeterminate', or may be a dynamically evaluated expression. + +Creating a new module in matplotlib.tests +----------------------------------------- + +Let's say you've added a new module named +``matplotlib.tests.test_whizbang_features``. For the buildbot slave +machines to know to run a test, nose must look in that module. To add +a module to the list searched, add the line:: + + args.append('matplotlib.tests.test_whizbang_features') + +into :file:`test/run-mpl-test.py`. Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 03:39:42 UTC (rev 7653) +++ trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 05:05:57 UTC (rev 7654) @@ -6,6 +6,14 @@ from matplotlib.testing.compare import compare_images def knownfailureif(fail_condition, msg=None): + """ + + Assume a will fail if *fail_condition* is True. *fail_condition* + may also be False or the string 'indeterminate'. + + *msg* is the error message displayed for the test. + + """ # based on numpy.testing.dec.knownfailureif if msg is None: msg = 'Test known to fail' @@ -29,6 +37,13 @@ return known_fail_decorator def image_comparison(baseline_images=None, tol=1e-3): + """ + compare images generated by the test with those specified in + *baseline_images*, which must correspond within tolerance *tol*, + else an ImageComparisonFailure exception will be raised. + + """ + if baseline_images is None: raise ValueError('baseline_images must be specified') def compare_images_decorator(func): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7653 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7653&view=rev Author: astraw Date: 2009年09月06日 03:39:42 +0000 (2009年9月06日) Log Message: ----------- testing: collect new image results on failed image comparisons Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/compare.py trunk/matplotlib/test/_buildbot_test_postmortem.py Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:44:09 UTC (rev 7652) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 03:39:42 UTC (rev 7653) @@ -7,6 +7,7 @@ import operator import os import numpy as np +import shutil #======================================================================= @@ -121,6 +122,7 @@ save_diff_image( expected, actual, diff_image ) if in_decorator: + shutil.copyfile( expected, 'expected-'+os.path.basename(actual)) results = dict( rms = rms, expected = str(expected), Modified: trunk/matplotlib/test/_buildbot_test_postmortem.py =================================================================== --- trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年09月06日 01:44:09 UTC (rev 7652) +++ trunk/matplotlib/test/_buildbot_test_postmortem.py 2009年09月06日 03:39:42 UTC (rev 7653) @@ -9,9 +9,10 @@ roots = ['test_matplotlib','test_plots'] savedresults_dir = 'saved-results' baseline_dir = 'baseline' -basename = 'failed-diff-' +expected_basename = 'expected-' +diff_basename = 'failed-diff-' target_dir = os.path.abspath('status_images') -nbase = len(basename) +nbase = len(diff_basename) def listFiles(root, patterns='*', recurse=1, return_folders=0): """ @@ -76,7 +77,31 @@ if os.path.exists(target_dir): shutil.rmtree(target_dir) os.makedirs( target_dir ) # prevent buildbot DirectoryUpload failure + + # new matplotlib.testing infrastructure + os.chdir('test') + for fname in glob.glob('*.png'): + absdiff_fname = diff_basename + fname + expected_fname = expected_basename + fname + if not os.path.exists(absdiff_fname): + continue + if not os.path.exists(expected_fname): + continue + print fname + print absdiff_fname + + teststr = os.path.splitext(fname)[0] + this_targetdir = os.path.join(target_dir,teststr) + os.makedirs( this_targetdir ) + shutil.copy( expected_fname, + os.path.join(this_targetdir,'baseline.png') ) + shutil.copy( fname, + os.path.join(this_targetdir,'actual.png') ) + shutil.copy( absdiff_fname, + os.path.join(this_targetdir,'absdiff.png') ) + + # old mplTest infrastructure for fpath in get_recursive_filelist(roots): # only images if not fpath.endswith('.png'): continue @@ -87,7 +112,7 @@ root = pieces[0] testclass = pieces[2] fname = pieces[3] - if not fname.startswith(basename): + if not fname.startswith(diff_basename): # only failed images continue origname = fname[nbase:] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7652 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7652&view=rev Author: astraw Date: 2009年09月06日 01:44:09 +0000 (2009年9月06日) Log Message: ----------- testing: implement image_comparison decorator Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/compare.py trunk/matplotlib/lib/matplotlib/testing/decorators.py trunk/matplotlib/lib/matplotlib/testing/noseclasses.py Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:43:59 UTC (rev 7651) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:44:09 UTC (rev 7652) @@ -72,7 +72,7 @@ return None #----------------------------------------------------------------------- -def compare_images( expected, actual, tol ): +def compare_images( expected, actual, tol, in_decorator=False ): '''Compare two image files - not the greatest, but fast and good enough. = EXAMPLE @@ -87,6 +87,8 @@ - actual The filename of the actual image. - tol The tolerance (a unitless float). This is used to determinte the 'fuzziness' to use when comparing images. + - in_decorator If called from image_comparison decorator, this should be + True. (default=False) ''' try: @@ -113,11 +115,21 @@ if ( (rms / 10000.0) <= tol ): return None + + diff_image = os.path.join(os.path.dirname(actual), + 'failed-diff-'+os.path.basename(actual)) + save_diff_image( expected, actual, diff_image ) + + if in_decorator: + results = dict( + rms = rms, + expected = str(expected), + actual = str(actual), + diff = str(diff_image), + ) + return results else: - diff_image = os.path.join(os.path.dirname(actual), - 'failed-diff-'+os.path.basename(actual)) - save_diff_image( expected, actual, diff_image ) - + # old-style call from mplTest directory msg = " Error: Image files did not match.\n" \ " RMS Value: " + str( rms / 10000.0 ) + "\n" \ " Expected:\n " + str( expected ) + "\n" \ @@ -130,6 +142,8 @@ from PIL import Image expectedImage = np.array(Image.open( expected ).convert("RGB")).astype(np.float) actualImage = np.array(Image.open( actual ).convert("RGB")).astype(np.float) + assert expectedImage.ndim==expectedImage.ndim + assert expectedImage.shape==expectedImage.shape absDiffImage = abs(expectedImage-actualImage) # expand differences in luminance domain absDiffImage *= 10 Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:43:59 UTC (rev 7651) +++ trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:44:09 UTC (rev 7652) @@ -1,6 +1,9 @@ from matplotlib.testing.noseclasses import KnownFailureTest, \ - KnownFailureDidNotFailTest + KnownFailureDidNotFailTest, ImageComparisonFailure import sys +import nose +from matplotlib.cbook import get_sample_data +from matplotlib.testing.compare import compare_images def knownfailureif(fail_condition, msg=None): # based on numpy.testing.dec.knownfailureif @@ -24,3 +27,23 @@ return result return nose.tools.make_decorator(f)(failer) return known_fail_decorator + +def image_comparison(baseline_images=None, tol=1e-3): + if baseline_images is None: + raise ValueError('baseline_images must be specified') + def compare_images_decorator(func): + def decorated_compare_images(*args,**kwargs): + result = func(*args,**kwargs) + for fname in baseline_images: + actual = fname + expected = get_sample_data('test_baseline_%s'%fname, + asfileobj=False) + err = compare_images( expected, actual, tol, + in_decorator=True ) + if err: + raise ImageComparisonFailure( + 'images not close: %(actual)s vs. %(expected)s ' + '(RMS %(rms).3f)'%err) + return result + return nose.tools.make_decorator(func)(decorated_compare_images) + return compare_images_decorator Modified: trunk/matplotlib/lib/matplotlib/testing/noseclasses.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/noseclasses.py 2009年09月06日 01:43:59 UTC (rev 7651) +++ trunk/matplotlib/lib/matplotlib/testing/noseclasses.py 2009年09月06日 01:44:09 UTC (rev 7652) @@ -9,6 +9,9 @@ '''Raise this exception to mark a test should have failed but did not.''' pass +class ImageComparisonFailure(Exception): + '''Raise this exception to mark a test as a comparison between two images.''' + class KnownFailure(ErrorClassPlugin): '''Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailureTest is raised, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7651 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7651&view=rev Author: astraw Date: 2009年09月06日 01:43:59 +0000 (2009年9月06日) Log Message: ----------- testing: give more informative error when nose plugin not installed Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/decorators.py Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:43:50 UTC (rev 7650) +++ trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:43:59 UTC (rev 7651) @@ -16,7 +16,7 @@ result = f(*args, **kwargs) except: if fail_condition: - raise KnownFailureTest(msg) + raise KnownFailureTest(msg) # An error here when running nose means that you don't have the matplotlib.testing.noseclasses:KnownFailure plugin in use. else: raise if fail_condition and fail_condition != 'indeterminate': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7650 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7650&view=rev Author: astraw Date: 2009年09月06日 01:43:50 +0000 (2009年9月06日) Log Message: ----------- testing: clip abs diff image Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/compare.py Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:43:40 UTC (rev 7649) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:43:50 UTC (rev 7650) @@ -133,6 +133,6 @@ absDiffImage = abs(expectedImage-actualImage) # expand differences in luminance domain absDiffImage *= 10 - save_image_np = absDiffImage.astype(np.uint8) + save_image_np = np.clip(absDiffImage,0,255).astype(np.uint8) save_image = Image.fromarray(save_image_np) save_image.save(output) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7649 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7649&view=rev Author: astraw Date: 2009年09月06日 01:43:40 +0000 (2009年9月06日) Log Message: ----------- testing: convert function names to MPL coding standard Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/compare.py trunk/matplotlib/test/mplTest/MplTestCase.py Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:43:29 UTC (rev 7648) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:43:40 UTC (rev 7649) @@ -11,12 +11,12 @@ #======================================================================= __all__ = [ - 'compareFloat', - 'compareImages', + 'compare_float', + 'compare_images', ] #----------------------------------------------------------------------- -def compareFloat( expected, actual, relTol = None, absTol = None ): +def compare_float( expected, actual, relTol = None, absTol = None ): """Fail if the floating point values are not close enough, with the givem message. @@ -72,7 +72,7 @@ return None #----------------------------------------------------------------------- -def compareImages( expected, actual, tol ): +def compare_images( expected, actual, tol ): '''Compare two image files - not the greatest, but fast and good enough. = EXAMPLE @@ -80,7 +80,7 @@ # img1 = "./baseline/plot.png" # img2 = "./output/plot.png" # - # compareImage( img1, img2, 0.001 ): + # compare_images( img1, img2, 0.001 ): = INPUT VARIABLES - expected The filename of the expected image. @@ -116,7 +116,7 @@ else: diff_image = os.path.join(os.path.dirname(actual), 'failed-diff-'+os.path.basename(actual)) - saveDiffImage( expected, actual, diff_image ) + save_diff_image( expected, actual, diff_image ) msg = " Error: Image files did not match.\n" \ " RMS Value: " + str( rms / 10000.0 ) + "\n" \ @@ -126,7 +126,7 @@ " Tolerance: " + str( tol ) + "\n" return msg -def saveDiffImage( expected, actual, output ): +def save_diff_image( expected, actual, output ): from PIL import Image expectedImage = np.array(Image.open( expected ).convert("RGB")).astype(np.float) actualImage = np.array(Image.open( actual ).convert("RGB")).astype(np.float) Modified: trunk/matplotlib/test/mplTest/MplTestCase.py =================================================================== --- trunk/matplotlib/test/mplTest/MplTestCase.py 2009年09月06日 01:43:29 UTC (rev 7648) +++ trunk/matplotlib/test/mplTest/MplTestCase.py 2009年09月06日 01:43:40 UTC (rev 7649) @@ -51,7 +51,7 @@ baselineImage = self.baseFile( basename ) - errorMessage = compare.compareImages( baselineImage, actualImage, tol ) + errorMessage = compare.compare_images( baselineImage, actualImage, tol ) if errorMessage: self.fail( msg + "\n" + errorMessage ) @@ -108,7 +108,7 @@ You can specify a relative tolerance, absolute tolerance, or both. """ - errorMessage = compare.compareFloat( expected, actual, relTol, absTol ) + errorMessage = compare.compare_float( expected, actual, relTol, absTol ) if errorMessage: self.fail( msg + "\n" + errorMessage ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7648 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7648&view=rev Author: astraw Date: 2009年09月06日 01:43:29 +0000 (2009年9月06日) Log Message: ----------- testing: initial spine test (test for SF#2852168) Modified Paths: -------------- trunk/matplotlib/test/run-mpl-test.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/test_spines.py Added: trunk/matplotlib/lib/matplotlib/tests/test_spines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_spines.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/tests/test_spines.py 2009年09月06日 01:43:29 UTC (rev 7648) @@ -0,0 +1,22 @@ +import numpy as np +import matplotlib +matplotlib.use('Agg') +from matplotlib.testing.decorators import image_comparison +import matplotlib.pyplot as plt + +@image_comparison(baseline_images=['spines_axes_positions.png']) +def test_spines_axes_positions(): + # SF bug 2852168 + fig = plt.figure() + x = np.linspace(0,2*np.pi,100) + y = 2*np.sin(x) + ax = fig.add_subplot(1,1,1) + ax.set_title('centered spines') + ax.plot(x,y) + ax.spines['right'].set_position(('axes',0.1)) + ax.yaxis.set_ticks_position('right') + ax.spines['top'].set_position(('axes',0.25)) + ax.xaxis.set_ticks_position('top') + ax.spines['left'].set_color('none') + ax.spines['bottom'].set_color('none') + fig.savefig('spines_axes_positions.png') Modified: trunk/matplotlib/test/run-mpl-test.py =================================================================== --- trunk/matplotlib/test/run-mpl-test.py 2009年09月06日 01:43:18 UTC (rev 7647) +++ trunk/matplotlib/test/run-mpl-test.py 2009年09月06日 01:43:29 UTC (rev 7648) @@ -93,6 +93,7 @@ args.append('.') args.append('matplotlib.tests.test_basic') args.append('matplotlib.tests.test_transforms') +args.append('matplotlib.tests.test_spines') success = nose.run( argv = args, plugins = [ MplNosePlugin(), KnownFailure() ] ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7647 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7647&view=rev Author: astraw Date: 2009年09月06日 01:43:18 +0000 (2009年9月06日) Log Message: ----------- testing: add new, simplified testing infrastructure Modified Paths: -------------- trunk/matplotlib/setup.py trunk/matplotlib/test/run-mpl-test.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/tests/ trunk/matplotlib/lib/matplotlib/tests/__init__.py trunk/matplotlib/lib/matplotlib/tests/test_basic.py trunk/matplotlib/lib/matplotlib/tests/test_transforms.py Added: trunk/matplotlib/lib/matplotlib/tests/test_basic.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_basic.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/tests/test_basic.py 2009年09月06日 01:43:18 UTC (rev 7647) @@ -0,0 +1,11 @@ +from nose.tools import assert_equal +from matplotlib.testing.decorators import knownfailureif + +def test_simple(): + '''very simple example test''' + assert_equal(1+1,2) + +@knownfailureif(True) +def test_simple_fail(): + '''very simple example test that should fail''' + assert_equal(1+1,3) Added: trunk/matplotlib/lib/matplotlib/tests/test_transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/tests/test_transforms.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/tests/test_transforms.py 2009年09月06日 01:43:18 UTC (rev 7647) @@ -0,0 +1,40 @@ +from nose.tools import assert_equal +from numpy.testing import assert_almost_equal +from matplotlib.transforms import Affine2D +import numpy as np + +def test_Affine2D_from_values(): + points = [ [0,0], + [10,20], + [-1,0], + ] + + t = Affine2D.from_values(1,0,0,0,0,0) + actual = t.transform(points) + expected = np.array( [[0,0],[10,0],[-1,0]] ) + assert_almost_equal(actual,expected) + + t = Affine2D.from_values(0,2,0,0,0,0) + actual = t.transform(points) + expected = np.array( [[0,0],[0,20],[0,-2]] ) + assert_almost_equal(actual,expected) + + t = Affine2D.from_values(0,0,3,0,0,0) + actual = t.transform(points) + expected = np.array( [[0,0],[60,0],[0,0]] ) + assert_almost_equal(actual,expected) + + t = Affine2D.from_values(0,0,0,4,0,0) + actual = t.transform(points) + expected = np.array( [[0,0],[0,80],[0,0]] ) + assert_almost_equal(actual,expected) + + t = Affine2D.from_values(0,0,0,0,5,0) + actual = t.transform(points) + expected = np.array( [[5,0],[5,0],[5,0]] ) + assert_almost_equal(actual,expected) + + t = Affine2D.from_values(0,0,0,0,0,6) + actual = t.transform(points) + expected = np.array( [[0,6],[0,6],[0,6]] ) + assert_almost_equal(actual,expected) Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2009年09月06日 01:43:05 UTC (rev 7646) +++ trunk/matplotlib/setup.py 2009年09月06日 01:43:18 UTC (rev 7647) @@ -51,6 +51,7 @@ 'matplotlib.backends', 'matplotlib.projections', 'matplotlib.testing', + 'matplotlib.tests', # 'matplotlib.toolkits', 'mpl_toolkits', 'mpl_toolkits.mplot3d', Modified: trunk/matplotlib/test/run-mpl-test.py =================================================================== --- trunk/matplotlib/test/run-mpl-test.py 2009年09月06日 01:43:05 UTC (rev 7646) +++ trunk/matplotlib/test/run-mpl-test.py 2009年09月06日 01:43:18 UTC (rev 7647) @@ -90,6 +90,9 @@ sys.exit( 0 ) ### Run nose +args.append('.') +args.append('matplotlib.tests.test_basic') +args.append('matplotlib.tests.test_transforms') success = nose.run( argv = args, plugins = [ MplNosePlugin(), KnownFailure() ] ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7646 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7646&view=rev Author: astraw Date: 2009年09月06日 01:43:05 +0000 (2009年9月06日) Log Message: ----------- testing: move image comparison functions into matplotlib.testing Modified Paths: -------------- trunk/matplotlib/test/mplTest/MplTestCase.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/testing/compare.py Removed Paths: ------------- trunk/matplotlib/test/mplTest/compare.py Copied: trunk/matplotlib/lib/matplotlib/testing/compare.py (from rev 7645, trunk/matplotlib/test/mplTest/compare.py) =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/compare.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/testing/compare.py 2009年09月06日 01:43:05 UTC (rev 7646) @@ -0,0 +1,138 @@ +#======================================================================= +""" A set of utilities for comparing results. +""" +#======================================================================= + +import math +import operator +import os +import numpy as np + +#======================================================================= + +__all__ = [ + 'compareFloat', + 'compareImages', + ] + +#----------------------------------------------------------------------- +def compareFloat( expected, actual, relTol = None, absTol = None ): + """Fail if the floating point values are not close enough, with + the givem message. + + You can specify a relative tolerance, absolute tolerance, or both. + """ + if relTol is None and absTol is None: + exMsg = "You haven't specified a 'relTol' relative tolerance " + exMsg += "or a 'absTol' absolute tolerance function argument. " + exMsg += "You must specify one." + raise ValueError, exMsg + + msg = "" + + if absTol is not None: + absDiff = abs( expected - actual ) + if absTol < absDiff: + expectedStr = str( expected ) + actualStr = str( actual ) + absDiffStr = str( absDiff ) + absTolStr = str( absTol ) + + msg += "\n" + msg += " Expected: " + expectedStr + "\n" + msg += " Actual: " + actualStr + "\n" + msg += " Abs Diff: " + absDiffStr + "\n" + msg += " Abs Tol: " + absTolStr + "\n" + + if relTol is not None: + # The relative difference of the two values. If the expected value is + # zero, then return the absolute value of the difference. + relDiff = abs( expected - actual ) + if expected: + relDiff = relDiff / abs( expected ) + + if relTol < relDiff: + + # The relative difference is a ratio, so it's always unitless. + relDiffStr = str( relDiff ) + relTolStr = str( relTol ) + + expectedStr = str( expected ) + actualStr = str( actual ) + + msg += "\n" + msg += " Expected: " + expectedStr + "\n" + msg += " Actual: " + actualStr + "\n" + msg += " Rel Diff: " + relDiffStr + "\n" + msg += " Rel Tol: " + relTolStr + "\n" + + if msg: + return msg + else: + return None + +#----------------------------------------------------------------------- +def compareImages( expected, actual, tol ): + '''Compare two image files - not the greatest, but fast and good enough. + + = EXAMPLE + + # img1 = "./baseline/plot.png" + # img2 = "./output/plot.png" + # + # compareImage( img1, img2, 0.001 ): + + = INPUT VARIABLES + - expected The filename of the expected image. + - actual The filename of the actual image. + - tol The tolerance (a unitless float). This is used to + determinte the 'fuzziness' to use when comparing images. + ''' + + try: + from PIL import Image, ImageOps, ImageFilter + except ImportError, e: + msg = "Image Comparison requires the Python Imaging Library to " \ + "be installed. To run tests without using PIL, then use " \ + "the '--without-tag=PIL' command-line option.\n" \ + "Importing PIL failed with the following error:\n%s" % e + return msg + + # open the image files and remove the alpha channel (if it exists) + expectedImage = Image.open( expected ).convert("RGB") + actualImage = Image.open( actual ).convert("RGB") + + # normalize the images + expectedImage = ImageOps.autocontrast( expectedImage, 2 ) + actualImage = ImageOps.autocontrast( actualImage, 2 ) + + # compare the resulting image histogram functions + h1 = expectedImage.histogram() + h2 = actualImage.histogram() + rms = math.sqrt( reduce(operator.add, map(lambda a,b: (a-b)**2, h1, h2)) / len(h1) ) + + if ( (rms / 10000.0) <= tol ): + return None + else: + diff_image = os.path.join(os.path.dirname(actual), + 'failed-diff-'+os.path.basename(actual)) + saveDiffImage( expected, actual, diff_image ) + + msg = " Error: Image files did not match.\n" \ + " RMS Value: " + str( rms / 10000.0 ) + "\n" \ + " Expected:\n " + str( expected ) + "\n" \ + " Actual:\n " + str( actual ) + "\n" \ + " Difference:\n " + str( diff_image ) + "\n" \ + " Tolerance: " + str( tol ) + "\n" + return msg + +def saveDiffImage( expected, actual, output ): + from PIL import Image + expectedImage = np.array(Image.open( expected ).convert("RGB")).astype(np.float) + actualImage = np.array(Image.open( actual ).convert("RGB")).astype(np.float) + absDiffImage = abs(expectedImage-actualImage) + # expand differences in luminance domain + absDiffImage *= 10 + save_image_np = absDiffImage.astype(np.uint8) + save_image = Image.fromarray(save_image_np) + save_image.save(output) Modified: trunk/matplotlib/test/mplTest/MplTestCase.py =================================================================== --- trunk/matplotlib/test/mplTest/MplTestCase.py 2009年09月06日 01:42:52 UTC (rev 7645) +++ trunk/matplotlib/test/mplTest/MplTestCase.py 2009年09月06日 01:43:05 UTC (rev 7646) @@ -6,7 +6,7 @@ import os.path import unittest -import compare +import matplotlib.testing.compare as compare import path_utils #======================================================================= Deleted: trunk/matplotlib/test/mplTest/compare.py =================================================================== --- trunk/matplotlib/test/mplTest/compare.py 2009年09月06日 01:42:52 UTC (rev 7645) +++ trunk/matplotlib/test/mplTest/compare.py 2009年09月06日 01:43:05 UTC (rev 7646) @@ -1,138 +0,0 @@ -#======================================================================= -""" A set of utilities for comparing results. -""" -#======================================================================= - -import math -import operator -import os -import numpy as np - -#======================================================================= - -__all__ = [ - 'compareFloat', - 'compareImages', - ] - -#----------------------------------------------------------------------- -def compareFloat( expected, actual, relTol = None, absTol = None ): - """Fail if the floating point values are not close enough, with - the givem message. - - You can specify a relative tolerance, absolute tolerance, or both. - """ - if relTol is None and absTol is None: - exMsg = "You haven't specified a 'relTol' relative tolerance " - exMsg += "or a 'absTol' absolute tolerance function argument. " - exMsg += "You must specify one." - raise ValueError, exMsg - - msg = "" - - if absTol is not None: - absDiff = abs( expected - actual ) - if absTol < absDiff: - expectedStr = str( expected ) - actualStr = str( actual ) - absDiffStr = str( absDiff ) - absTolStr = str( absTol ) - - msg += "\n" - msg += " Expected: " + expectedStr + "\n" - msg += " Actual: " + actualStr + "\n" - msg += " Abs Diff: " + absDiffStr + "\n" - msg += " Abs Tol: " + absTolStr + "\n" - - if relTol is not None: - # The relative difference of the two values. If the expected value is - # zero, then return the absolute value of the difference. - relDiff = abs( expected - actual ) - if expected: - relDiff = relDiff / abs( expected ) - - if relTol < relDiff: - - # The relative difference is a ratio, so it's always unitless. - relDiffStr = str( relDiff ) - relTolStr = str( relTol ) - - expectedStr = str( expected ) - actualStr = str( actual ) - - msg += "\n" - msg += " Expected: " + expectedStr + "\n" - msg += " Actual: " + actualStr + "\n" - msg += " Rel Diff: " + relDiffStr + "\n" - msg += " Rel Tol: " + relTolStr + "\n" - - if msg: - return msg - else: - return None - -#----------------------------------------------------------------------- -def compareImages( expected, actual, tol ): - '''Compare two image files - not the greatest, but fast and good enough. - - = EXAMPLE - - # img1 = "./baseline/plot.png" - # img2 = "./output/plot.png" - # - # compareImage( img1, img2, 0.001 ): - - = INPUT VARIABLES - - expected The filename of the expected image. - - actual The filename of the actual image. - - tol The tolerance (a unitless float). This is used to - determinte the 'fuzziness' to use when comparing images. - ''' - - try: - from PIL import Image, ImageOps, ImageFilter - except ImportError, e: - msg = "Image Comparison requires the Python Imaging Library to " \ - "be installed. To run tests without using PIL, then use " \ - "the '--without-tag=PIL' command-line option.\n" \ - "Importing PIL failed with the following error:\n%s" % e - return msg - - # open the image files and remove the alpha channel (if it exists) - expectedImage = Image.open( expected ).convert("RGB") - actualImage = Image.open( actual ).convert("RGB") - - # normalize the images - expectedImage = ImageOps.autocontrast( expectedImage, 2 ) - actualImage = ImageOps.autocontrast( actualImage, 2 ) - - # compare the resulting image histogram functions - h1 = expectedImage.histogram() - h2 = actualImage.histogram() - rms = math.sqrt( reduce(operator.add, map(lambda a,b: (a-b)**2, h1, h2)) / len(h1) ) - - if ( (rms / 10000.0) <= tol ): - return None - else: - diff_image = os.path.join(os.path.dirname(actual), - 'failed-diff-'+os.path.basename(actual)) - saveDiffImage( expected, actual, diff_image ) - - msg = " Error: Image files did not match.\n" \ - " RMS Value: " + str( rms / 10000.0 ) + "\n" \ - " Expected:\n " + str( expected ) + "\n" \ - " Actual:\n " + str( actual ) + "\n" \ - " Difference:\n " + str( diff_image ) + "\n" \ - " Tolerance: " + str( tol ) + "\n" - return msg - -def saveDiffImage( expected, actual, output ): - from PIL import Image - expectedImage = np.array(Image.open( expected ).convert("RGB")).astype(np.float) - actualImage = np.array(Image.open( actual ).convert("RGB")).astype(np.float) - absDiffImage = abs(expectedImage-actualImage) - # expand differences in luminance domain - absDiffImage *= 10 - save_image_np = absDiffImage.astype(np.uint8) - save_image = Image.fromarray(save_image_np) - save_image.save(output) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7645 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7645&view=rev Author: astraw Date: 2009年09月06日 01:42:52 +0000 (2009年9月06日) Log Message: ----------- testing: workaround issue with nose testing's ZeroNinePlugin Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/noseclasses.py Modified: trunk/matplotlib/lib/matplotlib/testing/noseclasses.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/noseclasses.py 2009年09月06日 01:42:43 UTC (rev 7644) +++ trunk/matplotlib/lib/matplotlib/testing/noseclasses.py 2009年09月06日 01:42:52 UTC (rev 7645) @@ -38,8 +38,15 @@ if disable: self.enabled = False - def addError( self, test, err ): + def addError( self, test, err, *zero_nine_capt_args ): # Fixme (Really weird): if I don't leave empty method here, # nose gets confused and KnownFails become testing errors when # using the MplNosePlugin and MplTestCase. + + # The *zero_nine_capt_args captures an extra argument. There + # seems to be a bug in + # nose.testing.manager.ZeroNinePlugin.addError() in which a + # 3rd positional argument ("capt") is passed to the plugin's + # addError() method, even if one is not explicitly using the + # ZeroNinePlugin. pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7644 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7644&view=rev Author: astraw Date: 2009年09月06日 01:42:43 +0000 (2009年9月06日) Log Message: ----------- testing: install KnownFailure nose plugin if using setuptools Modified Paths: -------------- trunk/matplotlib/setupegg.py Modified: trunk/matplotlib/setupegg.py =================================================================== --- trunk/matplotlib/setupegg.py 2009年09月06日 01:42:36 UTC (rev 7643) +++ trunk/matplotlib/setupegg.py 2009年09月06日 01:42:43 UTC (rev 7644) @@ -5,4 +5,9 @@ from setuptools import setup execfile('setup.py', {'additional_params' : - {'namespace_packages' : ['mpl_toolkits']}}) + {'namespace_packages' : ['mpl_toolkits'], + 'entry_points': {'nose.plugins': + [ + 'KnownFailure = matplotlib.testing.noseclasses:KnownFailure', + ] + }}}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7643 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7643&view=rev Author: astraw Date: 2009年09月06日 01:42:36 +0000 (2009年9月06日) Log Message: ----------- testing: switch known failure condition to 'indeterminate' for SF bug 2850075 Modified Paths: -------------- trunk/matplotlib/test/test_matplotlib/TestAxes.py Modified: trunk/matplotlib/test/test_matplotlib/TestAxes.py =================================================================== --- trunk/matplotlib/test/test_matplotlib/TestAxes.py 2009年09月06日 01:42:27 UTC (rev 7642) +++ trunk/matplotlib/test/test_matplotlib/TestAxes.py 2009年09月06日 01:42:36 UTC (rev 7643) @@ -43,7 +43,7 @@ pass #-------------------------------------------------------------------- - @knownfailureif(True, "Fails due to SF bug 2850075") + @knownfailureif('indeterminate', "Fails due to SF bug 2850075") def test_empty_datetime( self ): """Test plotting empty axes with dates along one axis.""" fname = self.outFile( "empty_datetime.png" ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7642 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7642&view=rev Author: astraw Date: 2009年09月06日 01:42:27 +0000 (2009年9月06日) Log Message: ----------- testing: allow fail_condition to be 'indeterminate' for knownfailureif decorator Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/decorators.py Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:42:16 UTC (rev 7641) +++ trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:42:27 UTC (rev 7642) @@ -19,7 +19,7 @@ raise KnownFailureTest(msg) else: raise - if fail_condition: + if fail_condition and fail_condition != 'indeterminate': raise KnownFailureDidNotFailTest(msg) return result return nose.tools.make_decorator(f)(failer) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7641 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7641&view=rev Author: astraw Date: 2009年09月06日 01:42:16 +0000 (2009年9月06日) Log Message: ----------- testing: add KnownFailureDidNotFailTest Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/testing/decorators.py trunk/matplotlib/lib/matplotlib/testing/noseclasses.py Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 00:53:54 UTC (rev 7640) +++ trunk/matplotlib/lib/matplotlib/testing/decorators.py 2009年09月06日 01:42:16 UTC (rev 7641) @@ -1,4 +1,5 @@ -from matplotlib.testing.noseclasses import KnownFailureTest +from matplotlib.testing.noseclasses import KnownFailureTest, \ + KnownFailureDidNotFailTest import sys def knownfailureif(fail_condition, msg=None): @@ -18,7 +19,8 @@ raise KnownFailureTest(msg) else: raise - # Fixme: Should raise KnownFailureDidNotFail if fail_condition==True? + if fail_condition: + raise KnownFailureDidNotFailTest(msg) return result return nose.tools.make_decorator(f)(failer) return known_fail_decorator Modified: trunk/matplotlib/lib/matplotlib/testing/noseclasses.py =================================================================== --- trunk/matplotlib/lib/matplotlib/testing/noseclasses.py 2009年09月06日 00:53:54 UTC (rev 7640) +++ trunk/matplotlib/lib/matplotlib/testing/noseclasses.py 2009年09月06日 01:42:16 UTC (rev 7641) @@ -5,6 +5,10 @@ '''Raise this exception to mark a test as a known failing test.''' pass +class KnownFailureDidNotFailTest(Exception): + '''Raise this exception to mark a test should have failed but did not.''' + pass + class KnownFailure(ErrorClassPlugin): '''Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailureTest is raised, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7639 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7639&view=rev Author: astraw Date: 2009年09月06日 00:14:26 +0000 (2009年9月06日) Log Message: ----------- Add baseline image for testing Added Paths: ----------- trunk/sample_data/test_baseline_spines_axes_positions.png Added: trunk/sample_data/test_baseline_spines_axes_positions.png =================================================================== (Binary files differ) Property changes on: trunk/sample_data/test_baseline_spines_axes_positions.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7640 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7640&view=rev Author: astraw Date: 2009年09月06日 00:53:54 +0000 (2009年9月06日) Log Message: ----------- Update test image without tight cropping. Modified Paths: -------------- trunk/sample_data/test_baseline_spines_axes_positions.png Modified: trunk/sample_data/test_baseline_spines_axes_positions.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7638 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7638&view=rev Author: astraw Date: 2009年09月05日 23:20:45 +0000 (2009年9月05日) Log Message: ----------- spines: fix 'axes' position bug (closes SF#2852168) Thanks to Jason Grout for reporting this. Modified Paths: -------------- branches/v0_99_maint/lib/matplotlib/spines.py Modified: branches/v0_99_maint/lib/matplotlib/spines.py =================================================================== --- branches/v0_99_maint/lib/matplotlib/spines.py 2009年09月05日 18:55:08 UTC (rev 7637) +++ branches/v0_99_maint/lib/matplotlib/spines.py 2009年09月05日 23:20:45 UTC (rev 7638) @@ -171,10 +171,14 @@ elif position_type=='axes': if self.spine_type in ('left','right'): self._spine_transform = ('pre', - mtransforms.Affine2D().translate(amount, 0.0)) + mtransforms.Affine2D.from_values( + # keep y unchanged, fix x at amount + 0,0,0,1,amount,0)) elif self.spine_type in ('bottom','top'): self._spine_transform = ('pre', - mtransforms.Affine2D().translate(0.0, amount)) + mtransforms.Affine2D.from_values( + # keep x unchanged, fix y at amount + 1,0,0,0,0,amount)) else: warnings.warn('unknown spine type "%s": no spine ' 'offset performed'%self.spine_type) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7637 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7637&view=rev Author: efiring Date: 2009年09月05日 18:55:08 +0000 (2009年9月05日) Log Message: ----------- Fix bug related to autoscaling and masked values in quiver Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/quiver.py Modified: trunk/matplotlib/lib/matplotlib/quiver.py =================================================================== --- trunk/matplotlib/lib/matplotlib/quiver.py 2009年09月04日 20:20:06 UTC (rev 7636) +++ trunk/matplotlib/lib/matplotlib/quiver.py 2009年09月05日 18:55:08 UTC (rev 7637) @@ -498,7 +498,11 @@ a = np.absolute(uv) if self.scale is None: sn = max(10, math.sqrt(self.N)) - scale = 1.8 * a[~self.Umask].mean() * sn / self.span # crude auto-scaling + if self.Umask is not ma.nomask: + amean = a[~self.Umask].mean() + else: + amean = a.mean() + scale = 1.8 * amean * sn / self.span # crude auto-scaling self.scale = scale length = a/(self.scale*self.width) X, Y = self._h_arrows(length) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7636 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7636&view=rev Author: leejjoon Date: 2009年09月04日 20:20:06 +0000 (2009年9月04日) Log Message: ----------- textpath.py: import texmanager only when required Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/demo_text_path.py trunk/matplotlib/lib/matplotlib/textpath.py Modified: trunk/matplotlib/examples/pylab_examples/demo_text_path.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/demo_text_path.py 2009年09月04日 19:11:00 UTC (rev 7635) +++ trunk/matplotlib/examples/pylab_examples/demo_text_path.py 2009年09月04日 20:20:06 UTC (rev 7636) @@ -54,6 +54,8 @@ if 1: + usetex = plt.rcParams["text.usetex"] + fig = plt.figure(1) # EXAMPLE 1 @@ -80,8 +82,14 @@ # another text from matplotlib.patches import PathPatch - text_path = TextPath((0, 0), r"\mbox{textpath supports mathtext \& \TeX}", - size=20, usetex=True) + if usetex: + r = r"\mbox{textpath supports mathtext \& \TeX}" + else: + r = r"textpath supports mathtext & TeX" + + text_path = TextPath((0, 0), r, + size=20, usetex=usetex) + p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9, transform=IdentityTransform()) p2 = PathPatch(text_path, ec="none", fc="k", @@ -111,7 +119,6 @@ arr = np.arange(256).reshape(1,256)/256. - usetex = plt.rcParams["text.usetex"] if usetex: s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!" else: Modified: trunk/matplotlib/lib/matplotlib/textpath.py =================================================================== --- trunk/matplotlib/lib/matplotlib/textpath.py 2009年09月04日 19:11:00 UTC (rev 7635) +++ trunk/matplotlib/lib/matplotlib/textpath.py 2009年09月04日 20:20:06 UTC (rev 7636) @@ -9,7 +9,6 @@ from matplotlib.mathtext import MathTextParser import matplotlib.dviread as dviread -from matplotlib.texmanager import TexManager import numpy as np @@ -31,6 +30,7 @@ from matplotlib.cbook import maxdict self._ps_fontd = maxdict(50) + self._texmanager = None def _get_font(self, prop): """ @@ -243,7 +243,16 @@ return zip(glyph_ids, xpositions, ypositions, sizes), glyph_map, myrects + def get_texmanager(self): + """ + return the :class:`matplotlib.texmanager.TexManager` instance + """ + if self._texmanager is None: + from matplotlib.texmanager import TexManager + self._texmanager = TexManager() + return self._texmanager + def get_glyphs_tex(self, prop, s): """ convert the string *s* to vertices and codes using matplotlib's usetex mode. @@ -251,7 +260,7 @@ # codes are modstly borrowed from pdf backend. - texmanager = TexManager() + texmanager = self.get_texmanager() if self.tex_font_map is None: self.tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map')) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.