[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Jul 26 12:46:04 PDT 2012
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/704af5575089/
changeset: 704af5575089
branch: yt
user: MatthewTurk
date: 2012-07-26 21:20:18
summary: Fixes to the test runner to make it more informative when it fails. Also
adding return values to the PlotWindow.save() commands, which are the
filenames. A fun thing to do within an html notebook:
from IPython.core.display import Image
names = pw.save()
for n in names: Image(filename=n)
affected #: 4 files
diff -r 293eaa42c317d01bf78d9360046ad16e4d821f62 -r 704af55750895661c1d43f41bd296cab1e4e958f tests/runall.py
--- a/tests/runall.py
+++ b/tests/runall.py
@@ -126,7 +126,9 @@
failures = 0
passes = 1
for test_name, result in sorted(rtr.passed_tests.items()):
- print "TEST %s: %s" % (test_name, result)
+ if not result:
+ print "TEST %s: %s" % (test_name, result)
+ print " %s" % rtr.test_messages[test_name]
if result: passes += 1
else: failures += 1
print "Number of passes : %s" % passes
diff -r 293eaa42c317d01bf78d9360046ad16e4d821f62 -r 704af55750895661c1d43f41bd296cab1e4e958f yt/utilities/answer_testing/output_tests.py
--- a/yt/utilities/answer_testing/output_tests.py
+++ b/yt/utilities/answer_testing/output_tests.py
@@ -56,9 +56,9 @@
class ArrayDelta(ValueDelta):
def __repr__(self):
nabove = len(na.where(self.delta > self.acceptable)[0])
- return "ArrayDelta: Delta %s, max of %s, acceptable of %s.\n" \
+ return "ArrayDelta: Delta max of %s, acceptable of %s.\n" \
"%d of %d points above the acceptable limit" % \
- (self.delta, self.delta.max(), self.acceptable, nabove,
+ (na.nanmax(self.delta), self.acceptable, nabove,
self.delta.size)
class ShapeMismatch(RegressionTestException):
diff -r 293eaa42c317d01bf78d9360046ad16e4d821f62 -r 704af55750895661c1d43f41bd296cab1e4e958f yt/utilities/answer_testing/runner.py
--- a/yt/utilities/answer_testing/runner.py
+++ b/yt/utilities/answer_testing/runner.py
@@ -95,6 +95,7 @@
self.results = RegressionTestStorage(results_id, path=results_path)
self.plot_list = {}
self.passed_tests = {}
+ self.test_messages = {}
self.plot_tests = plot_tests
def run_all_tests(self):
@@ -133,31 +134,32 @@
if self.plot_tests:
self.plot_list[test.name] = test.plot()
self.results[test.name] = test.result
- success, msg = self._compare(test)
+ success, msg, exc = self._compare(test)
if self.old_results is None:
print "NO OLD RESULTS"
else:
if success == True: print "SUCCEEDED"
else: print "FAILED", msg
self.passed_tests[test.name] = success
+ self.test_messages[test.name] = msg
if self.watcher is not None:
if success == True:
self.watcher.addSuccess(test.name)
else:
- self.watcher.addFailure(test.name, msg)
+ self.watcher.addFailure(test.name, exc)
def _compare(self, test):
if self.old_results is None:
- return (True, "New Test")
+ return (True, "", "New Test")
try:
old_result = self.old_results[test.name]
except FileNotExistException:
return (False, sys.exc_info())
try:
test.compare(old_result)
- except RegressionTestException, exc:
- return (False, sys.exc_info())
- return (True, "Pass")
+ except RegressionTestException as exc:
+ return (False, repr(exc), sys.exc_info())
+ return (True, "", "Pass")
def run_tests_from_file(self, filename):
for line in open(filename):
diff -r 293eaa42c317d01bf78d9360046ad16e4d821f62 -r 704af55750895661c1d43f41bd296cab1e4e958f yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -665,9 +665,8 @@
"""
if name == None:
name = str(self.pf)
- elif name[-4:] == '.png':
- v.save(name)
- return
+ elif name.endswith('.png'):
+ return v.save(name)
axis = axis_names[self.data_source.axis]
if 'Slice' in self.data_source.__class__.__name__:
type = 'Slice'
@@ -675,13 +674,15 @@
type = 'Projection'
if 'Cutting' in self.data_source.__class__.__name__:
type = 'OffAxisSlice'
- for k,v in self.plots.iteritems():
+ names = []
+ for k, v in self.plots.iteritems():
if axis:
n = "%s_%s_%s_%s" % (name, type, axis, k)
else:
# for cutting planes
n = "%s_%s_%s" % (name, type, k)
- v.save(n)
+ names.append(v.save(n))
+ return names
class SlicePlot(PWViewerMPL):
def __init__(self, pf, axis, fields, center='c', width=(1,'unitary'), origin='center-window'):
@@ -1035,6 +1036,7 @@
mylog.warning("Unknown suffix %s, defaulting to Agg", suffix)
canvas = FigureCanvasAgg(self.figure)
canvas.print_figure(fn)
+ return fn
class WindowPlotMPL(PlotMPL):
def __init__(self, data, extent, field_transform, cmap, size, zlim):
https://bitbucket.org/yt_analysis/yt/changeset/83670de989ea/
changeset: 83670de989ea
branch: yt
user: MatthewTurk
date: 2012-07-26 21:45:46
summary: Adding a check for Cython version to setup.py, along with instructions on how
to upgrade.
affected #: 1 file
diff -r 704af55750895661c1d43f41bd296cab1e4e958f -r 83670de989ea958a10644e2b9630f14bf420d421 setup.py
--- a/setup.py
+++ b/setup.py
@@ -9,6 +9,7 @@
from numpy.distutils.misc_util import appendpath
from numpy.distutils import log
+from distutils import version
REASON_FILES = []
REASON_DIRS = [
@@ -39,10 +40,19 @@
# Verify that we have Cython installed
try:
import Cython
+ if version.LooseVersion(Cython.__version__) < version.LooseVersion('0.16'):
+ needs_cython = True
+ else:
+ needs_cython = False
except ImportError as e:
+ needs_cython = True
+
+if needs_cython:
print "Cython is a build-time requirement for the source tree of yt."
print "Please either install yt from a provided, release tarball,"
- print "or install Cython (version 0.15 or higher)."
+ print "or install Cython (version 0.16 or higher)."
+ print "You may be able to accomplish this by typing:"
+ print " pip install -U Cython"
sys.exit(1)
######
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list