[yt-svn] commit/yt: MatthewTurk: Adding sim_dir_load and an option path argument to requires_outputlog

Bitbucket commits-noreply at bitbucket.org
Wed Nov 7 12:29:04 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/41c8bf82c39f/
changeset:   41c8bf82c39f
branch:      yt
user:        MatthewTurk
date:        2012-11-07 21:28:54
summary:     Adding sim_dir_load and an option path argument to requires_outputlog
affected #:  1 file

diff -r 353dd610ecef29427f9c333c7e2581bd0ffcfeb9 -r 41c8bf82c39fdb3bd150823ae52fec95d9fa2fbe yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -150,6 +150,14 @@
         pf.h
         return pf
 
+def sim_dir_load(sim_fn, path = None, sim_type = "Enzo"):
+    if path is None and not os.path.exists(sim_fn):
+        raise IOError
+    if os.path.exists(sim_fn) or not path:
+        path = "."
+    with temp_cwd(path):
+        return Simulation(sim_fn, sim_type = sim_type)
+
 class AnswerTestingTest(object):
     reference_storage = None
     def __init__(self, pf_fn):
@@ -373,13 +381,16 @@
         for newc, oldc in zip(new_result["children"], old_result["children"]):
             assert(newp == oldp)
 
-def requires_outputlog():
+def requires_outputlog(path = "."):
     def ffalse(func):
         return lambda: None
     def ftrue(func):
         return func
     if os.path.exists("OutputLog"):
         return ftrue
+    with temp_cwd(path):
+        if os.path.exists("OutputLog"):
+            return ftrue
     return ffalse
 
 def requires_pf(pf_fn, big_data = False):

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