From 4147443b3cd477fd25919bc978c9487d44e81b2d Mon Sep 17 00:00:00 2001 From: bolliger32 Date: Mon, 17 Jun 2019 03:32:29 +0000 Subject: [PATCH] switch test chdir location --- src/python/clawutil/test.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/python/clawutil/test.py b/src/python/clawutil/test.py index 76a181f..55fd5ad 100644 --- a/src/python/clawutil/test.py +++ b/src/python/clawutil/test.py @@ -215,14 +215,17 @@ def write_rundata_objects(self, path=None): if path is None: path = self.temp_path + # need to cwd b/c setrun.py files contain + # relative paths to topofiles and fgmax files + cwd = os.getcwd() + os.chdir(path) self.rundata.write(out_dir=path) + os.chdir(cwd) def run_code(self): r"""Run test code given an already compiled executable""" - - cwd = os.getcwd() - os.chdir(self.temp_path) + runclaw.runclaw(xclawcmd=os.path.join(self.temp_path,self.executable_name), rundir=self.temp_path, outdir=self.temp_path, @@ -230,7 +233,6 @@ def run_code(self): restart=False, xclawout=self.stdout, xclawerr=self.stderr) - os.chdir(cwd) self.stdout.flush() self.stderr.flush() @@ -251,14 +253,11 @@ def runTest(self, save=False, indices=(2, 3)): """ # Write out data files - cwd = os.getcwd() - os.chdir(self.temp_path) self.load_rundata() self.write_rundata_objects() # Run code self.run_code() - os.chdir(cwd) # Perform tests # Override this class to perform data checks, as is this class will