[yt-svn] commit/yt: chummels: Merged in xarthisius/yt (pull request #2056)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Mar 24 09:21:59 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/10bf552980ab/
Changeset: 10bf552980ab
Branch: yt
User: chummels
Date: 2016-03-24 16:21:50+00:00
Summary: Merged in xarthisius/yt (pull request #2056)
Let test datasets paths be handled by convenience functions instead of doing chdir
Affected #: 1 file
diff -r f12067d78ef445599aa567bc5e38a6406bef9f06 -r 10bf552980ab547ece30ab77e8ccd522d440a74e yt/utilities/answer_testing/framework.py
--- a/yt/utilities/answer_testing/framework.py
+++ b/yt/utilities/answer_testing/framework.py
@@ -264,14 +264,13 @@
path = ytcfg.get("yt", "test_data_dir")
if not os.path.isdir(path):
return False
- with temp_cwd(path):
- if file_check:
- return os.path.isfile(ds_fn) and \
- AnswerTestingTest.result_storage is not None
- try:
- load(ds_fn)
- except YTOutputNotIdentified:
- return False
+ if file_check:
+ return os.path.isfile(os.path.join(path, ds_fn)) and \
+ AnswerTestingTest.result_storage is not None
+ try:
+ load(ds_fn)
+ except YTOutputNotIdentified:
+ return False
return AnswerTestingTest.result_storage is not None
def can_run_sim(sim_fn, sim_type, file_check = False):
@@ -280,14 +279,13 @@
path = ytcfg.get("yt", "test_data_dir")
if not os.path.isdir(path):
return False
- with temp_cwd(path):
- if file_check:
- return os.path.isfile(sim_fn) and \
- AnswerTestingTest.result_storage is not None
- try:
- simulation(sim_fn, sim_type)
- except YTOutputNotIdentified:
- return False
+ if file_check:
+ return os.path.isfile(os.path.join(path, sim_fn)) and \
+ AnswerTestingTest.result_storage is not None
+ try:
+ simulation(sim_fn, sim_type)
+ except YTOutputNotIdentified:
+ return False
return AnswerTestingTest.result_storage is not None
def data_dir_load(ds_fn, cls = None, args = None, kwargs = None):
@@ -297,13 +295,12 @@
if isinstance(ds_fn, Dataset): return ds_fn
if not os.path.isdir(path):
return False
- with temp_cwd(path):
- if cls is None:
- ds = load(ds_fn, *args, **kwargs)
- else:
- ds = cls(ds_fn, *args, **kwargs)
- ds.index
- return ds
+ if cls is None:
+ ds = load(ds_fn, *args, **kwargs)
+ else:
+ ds = cls(os.path.join(path, ds_fn), *args, **kwargs)
+ ds.index
+ return ds
def sim_dir_load(sim_fn, path = None, sim_type = "Enzo",
find_outputs=False):
@@ -311,9 +308,8 @@
raise IOError
if os.path.exists(sim_fn) or not path:
path = "."
- with temp_cwd(path):
- return simulation(sim_fn, sim_type,
- find_outputs=find_outputs)
+ return simulation(os.path.join(path, sim_fn), sim_type,
+ find_outputs=find_outputs)
class AnswerTestingTest(object):
reference_storage = None
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160324/75a040d6/attachment.htm>
More information about the yt-svn
mailing list