Commits

Sam Skillman committed 7960563

Fixing expansion tests and test_orbit test. Also update test runner so that it
reads "Test 1 of 1." instead of "Test 0 of 1."

  • Participants
  • Parent commits 114d0e3

Comments (0)

Files changed (4)

File run/GravitySolver/TestOrbit/test_orbit.py

 from yt.mods import *
 from yt.testing import *
 from yt.utilities.answer_testing.framework import \
-     FieldValuesTest, \
+     AllFieldValuesTest, \
      sim_dir_load
 from yt.frontends.enzo.answer_testing_support import \
      requires_outputlog

File run/Hydro/Hydro-1D/FreeExpansion/test_free_expansion.py

 
     def __init__(self, pf):
         self.pf = pf
-    
+
     def run(self):
         ray = self.pf.h.ray([0.0,0.5,0.5], [1.0,0.5,0.5])
         ray_length = np.sqrt(((ray.end_point - ray.start_point)**2).sum())
-        ipos = na.where(ray['VelocityMagnitude'] == 0.0)[0].argmin()
+        ipos = na.argwhere(ray['VelocityMagnitude'] == 0.0)
+        if len(ipos) > 0:
+            ipos = ipos.min()
+        else:
+            ipos = -1
         return ray_length * ray['t'][ipos]
 
     def compare(self, new_result, old_result):
-        assert_rel_equal(new_result, old_result, 2,
-                         verbose=True)
+        assert_allclose(new_result, old_result, 1.0e-2, 0.0)
 
 @requires_outputlog(_dir_name, _pf_name)
 def test_collapse_max_value():

File run/Hydro/Hydro-2D/FreeExpansionAMR/test_free_expansion.py

     def run(self):
         ray = self.pf.h.ray([0.0,0.0,0.5], [1.0,1.0,0.5])
         ray_length = np.sqrt(((ray.end_point - ray.start_point)**2).sum())
-        ipos = na.where(ray['VelocityMagnitude'] == 0.0)[0].argmin()
+        ipos = na.argwhere(ray['VelocityMagnitude'] == 0.0)
+        if len(ipos) > 0:
+            ipos = ipos.min()
+        else:
+            ipos = -1
         return ray_length * ray['t'][ipos]
 
     def compare(self, new_result, old_result):
-        assert_rel_equal(new_result, old_result, 2,
-                         verbose=True)
+        assert_allclose(new_result, old_result, 1.0e-2, 0.0)
 
 @requires_outputlog(_dir_name, _pf_name)
 def test_collapse_max_value():

File run/test_runner.py

                 self.test_container.append(EnzoTestRun(output_dir, my_test, 
                                                        machine, exe_path))
                 if not test_only:
-                    print "Running simulation: %d of %d." % (i, total_tests)
+                    print "Running simulation: %d of %d." % (i+1, total_tests)
                     self.test_container[i].run_sim()
                 if not sim_only:
-                    print "Running test: %d of %d." % (i, total_tests)
+                    print "Running test: %d of %d." % (i+1, total_tests)
                     self.test_container[-1].run_test()
         else:
             self.prepare_all_tests(output_dir, machine, exe_path)
         total_tests = len(self.test_container)
         print "Running all simulations."
         for i, my_test in enumerate(self.test_container):
-            print "Running simulation: %d of %d." % (i, total_tests)
+            print "Running simulation: %d of %d." % (i+1, total_tests)
             my_test.run_sim()
 
     def run_all_tests(self):
         total_tests = len(self.test_container)
         print "Running all tests."
         for i, my_test in enumerate(self.test_container):
-            print "Running test: %d of %d." % (i, total_tests)
+            print "Running test: %d of %d." % (i+1, total_tests)
             my_test.run_test()
 
     def add_test(self, fn):