From b926ef578d557f17294db0f77c33143d4a206060 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Thu, 28 Apr 2016 17:46:38 -0700
Subject: [PATCH] making sure tests run in correct directory

---
 test/run_tests.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/run_tests.py b/test/run_tests.py
index f5cd4fa..dc259b4 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -14,6 +14,8 @@ class bcolors:
     
 errors = []
 
+testdir = os.getcwd()
+
 print("----------------------------------------------------------------------------------------")
 
 for path, folders, files in os.walk("./test_scripts"):
@@ -25,6 +27,7 @@ for path, folders, files in os.walk("./test_scripts"):
             with open(filename) as f:
                 print("RUNNING: " + filename)
                 try:
+                    os.chdir(path)
                     code = compile(f.read(), filename, 'exec')
                     exec(code)
                 except Exception as ex:
@@ -33,7 +36,8 @@ for path, folders, files in os.walk("./test_scripts"):
                     traceback.print_exc()
                     errors.append(filename)
                     print(bcolors.ENDC)
-        
+                finally:
+                    os.chdir(testdir)
                 print("----------------------------------------------------------------------------------------")
     
 
-- 
GitLab