From 48c2e23912c6e0c6be4072fc7f521cdb4be156ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Orvisk=C3=BD?= <orvisky.tomas@centrum.cz>
Date: Sun, 28 Apr 2024 16:01:02 +0200
Subject: [PATCH] relative paths to tests

---
 tests/PyPlamlTest.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/PyPlamlTest.py b/tests/PyPlamlTest.py
index 9a09f33..53ee19a 100644
--- a/tests/PyPlamlTest.py
+++ b/tests/PyPlamlTest.py
@@ -1,6 +1,6 @@
 import os
+import pathlib
 import unittest
-from glob import glob
 
 from pyplaml import *
 
@@ -8,8 +8,10 @@ from pyplaml import *
 # noinspection PyBroadException
 class PyPlamlTest(unittest.TestCase):
     def setUp(self):
+        puml_files = pathlib.Path(__file__).parent.parent / 'examples' / 'plantuml'
+
         self.parser = PUMLParser()
-        self.examples_sorted = sorted(glob("../examples/plantuml/*.puml"))
+        self.examples_sorted = sorted(puml_files.glob("*.puml"))
 
     def test_lexer(self):
         for example_file in self.examples_sorted:
@@ -23,9 +25,11 @@ class PyPlamlTest(unittest.TestCase):
                 self.assertTrue(False, f"Parser exception in {example_file}")
 
     def test_drawing(self):
+        main_script = Path(__file__).parent.parent / 'main.py'
+
         for e in self.examples_sorted:
             self.assertEqual(
-                os.system("python ../main.py " + e),
+                os.system(f"python {main_script} {e}"),
                 0,
                 f"Drawing \"{e}\" failed"
             )
-- 
GitLab