Revision: 7658
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7658&view=rev
Author:   astraw
Date:     2009-09-06 19:29:45 +0000 (Sun, 06 Sep 2009)

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.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to