SF.net SVN: matplotlib:[7843] trunk/matplotlib/lib/matplotlib/testing/ decorators.py

2009-10-04 Thread jouni
Revision: 7843
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7843&view=rev
Author:   jouni
Date: 2009-10-04 18:55:18 + (Sun, 04 Oct 2009)

Log Message:
---
@image_comparison now makes a generator that yields a test case for each file 
format (currently png, pdf)

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-10-03 
18:11:09 UTC (rev 7842)
+++ trunk/matplotlib/lib/matplotlib/testing/decorators.py   2009-10-04 
18:55:18 UTC (rev 7843)
@@ -42,66 +42,84 @@
 compare images generated by the test with those specified in
 *baseline_images*, which must correspond else an
 ImageComparisonFailure exception will be raised.
-
 """
 
 if baseline_images is None:
 raise ValueError('baseline_images must be specified')
+
+# The multiple layers of defs are required because of how
+# parameterized decorators work, and because we want to turn the
+# single test_foo function to a generator that generates a
+# separate test case for each file format.
 def compare_images_decorator(func):
-def decorated_compare_images(*args,**kwargs):
+baseline_dir, result_dir = _image_directories(func)
+# Only run the test if there is a baseline image in the
+# correct format for comparison.
+extensions = [ext for ext in ['png', 'pdf']
+  if os.path.exists(os.path.join(
+  baseline_dir, baseline_images[0] + '.' + ext))]
 
-# compute baseline image directory
-module_name = func.__module__
-if module_name=='__main__':
-# FIXME: this won't work for nested packages in 
matplotlib.tests
-import warnings
-warnings.warn('test module run as script. guessing baseline 
image locations')
-script_name = sys.argv[0]
-basedir = os.path.abspath(os.path.dirname(script_name))
-subdir = os.path.splitext(os.path.split(script_name)[1])[0]
-else:
-mods = module_name.split('.')
-assert mods.pop(0)=='matplotlib'
-assert mods.pop(0)=='tests'
-subdir = os.path.join(*mods)
-basedir = os.path.dirname(matplotlib.tests.__file__)
-baseline_dir = os.path.join(basedir,'baseline_images',subdir)
-result_dir = os.path.join(basedir,'current_images',subdir)
-if not os.path.exists(result_dir):
-try:
-# make the current_images directory first
-os.mkdir(os.path.join(basedir,'current_images'))
-except OSError:
-pass # probably exists already
-os.mkdir(result_dir)
+def compare_images_generator():
+for extension in extensions:
+@knownfailureif(extension not in comparable_formats(),
+'Cannot compare %s files on this system' % 
extension)
+def decorated_compare_images():
+# set the default format of savefig
+matplotlib.rc('savefig', extension=extension)
+# change to the result directory for the duration of the 
test
+old_dir = os.getcwd()
+os.chdir(result_dir)
+try:
+result = func() # actually call the test function
+finally:
+os.chdir(old_dir)
+for fname in baseline_images:
+actual = os.path.join(result_dir, fname) + '.' + 
extension
+expected = os.path.join(baseline_dir,fname) + '.' + 
extension
 
-for extension in ['png', 'pdf']:
-# set the default format of savefig
-matplotlib.rc('savefig', extension=extension)
-# change to the result directory for the duration of the test
-old_dir = os.getcwd()
-os.chdir(result_dir)
-try:
-last_result = func(*args,**kwargs) # actually call the 
test function
-finally:
-os.chdir(old_dir)
-for fname in baseline_images:
-actual = os.path.join(result_dir, fname) + '.' + extension
-expected = os.path.join(baseline_dir,fname) + '.' + 
extension
-if (extension not in comparable_formats()
-or not os.path.exists(expected)):
-# FIXME: Should it be a known fail if this format
-# cannot be compared in this environment?
-continue
+  

SF.net SVN: matplotlib:[7844] branches/v0_99_maint/lib/matplotlib/axes.py

2009-10-04 Thread leejjoon
Revision: 7844
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7844&view=rev
Author:   leejjoon
Date: 2009-10-05 02:05:16 + (Mon, 05 Oct 2009)

Log Message:
---
image created by imshow support remove method

Modified Paths:
--
branches/v0_99_maint/lib/matplotlib/axes.py

Modified: branches/v0_99_maint/lib/matplotlib/axes.py
===
--- branches/v0_99_maint/lib/matplotlib/axes.py 2009-10-04 18:55:18 UTC (rev 
7843)
+++ branches/v0_99_maint/lib/matplotlib/axes.py 2009-10-05 02:05:16 UTC (rev 
7844)
@@ -6293,6 +6293,7 @@
 if self._autoscaleYon:
 self.set_ylim((ymin, ymax))
 self.images.append(im)
+im._remove_method = lambda h: self.images.remove(h)
 
 return im
 imshow.__doc__ = cbook.dedent(imshow.__doc__) % martist.kwdocd


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7845] trunk/matplotlib

2009-10-04 Thread leejjoon
Revision: 7845
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7845&view=rev
Author:   leejjoon
Date: 2009-10-05 02:12:36 + (Mon, 05 Oct 2009)

Log Message:
---
Merged revisions 7840-7844 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint


  r7844 | leejjoon | 2009-10-04 22:05:16 -0400 (Sun, 04 Oct 2009) | 1 line
  
  image created by imshow support remove method


Modified Paths:
--
trunk/matplotlib/lib/matplotlib/axes.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

trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.png


Property changes on: trunk/matplotlib
___
Modified: svnmerge-integrated
   - /branches/mathtex:1-7263 /branches/v0_99_maint:1-7839
   + /branches/mathtex:1-7263 /branches/v0_99_maint:1-7844
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,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837
   + /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,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844


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,7638,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837
   + 
/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,7703,7727-7734,7740-7741,7745,7751,7756,7762,7770,7772,7774,7776-7778,7780,7784,7788,7790,7792,7794,7796,7800,7803,7808,7822,7827,7834,7837,7844


Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___
Modified: svn:mergeinfo
   - /branch