From fbe4419206251c20ba03de3f8a5c51b21e663f93 Mon Sep 17 00:00:00 2001
From: Derval Guillaume <gderval@uliege.be>
Date: Tue, 25 Jun 2024 13:42:50 +0200
Subject: [PATCH] Make tests resilient to workdir changes

---
 tests/test_import.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/test_import.py b/tests/test_import.py
index 2d3f4ec..705a72a 100644
--- a/tests/test_import.py
+++ b/tests/test_import.py
@@ -13,10 +13,10 @@ class TestImport(unittest.TestCase):
             """
                 #TIMEHORIZON
                     T = 8760;
-                #NODE A extends B from "instances/imports/b_nogen.gboml";
+                #NODE A extends B from "imports/b_nogen.gboml";
             """
         )
-        print(resolve_imports(tree, Path('.'), parser))
+        print(resolve_imports(tree, Path(__file__).parent / "instances", parser))
 
     def test_import_nogen_2(self):
         parser = GBOMLParser()
@@ -24,14 +24,14 @@ class TestImport(unittest.TestCase):
             """
                 #TIMEHORIZON
                     T = 8760;
-                #NODE A extends B from "instances/imports/b_nogen.gboml"
+                #NODE A extends B from "imports/b_nogen.gboml"
                     #PARAMETERS
                         i = 2;
                     #VARIABLES
                         pass;
             """
         )
-        print(resolve_imports(tree, Path('.'), parser))
+        print(resolve_imports(tree, Path(__file__).parent / "instances", parser))
 
     def test_import_gen_1(self):
         parser = GBOMLParser()
@@ -39,14 +39,14 @@ class TestImport(unittest.TestCase):
             """
                 #TIMEHORIZON
                     T = 8760;
-                #NODE A extends B[2] from "instances/imports/b_gen.gboml"
+                #NODE A extends B[2] from "imports/b_gen.gboml"
                     #PARAMETERS
                         j = 2;
                     #VARIABLES
                         pass;
             """
         )
-        print(resolve_imports(tree, Path('.'), parser))
+        print(resolve_imports(tree, Path(__file__).parent / "instances", parser))
 
     @unittest.expectedFailure
     def test_import_gen_2(self):
@@ -55,14 +55,14 @@ class TestImport(unittest.TestCase):
             """
                 #TIMEHORIZON
                     T = 8760;
-                #NODE A extends B[2] from "instances/imports/b_gen.gboml"
+                #NODE A extends B[2] from "imports/b_gen.gboml"
                     #PARAMETERS
                         i = 2; //this should fail, as i is an index of B
                     #VARIABLES
                         pass;
             """
         )
-        print(resolve_imports(tree, Path('.'), parser))
+        print(resolve_imports(tree, Path(__file__).parent / "instances", parser))
 
 if __name__ == '__main__':
     unittest.main()
-- 
GitLab