Skip to content
Snippets Groups Projects
Commit 48c2e239 authored by Tomáš Orviský's avatar Tomáš Orviský
Browse files

relative paths to tests

parent 3dce63fd
No related merge requests found
import os import os
import pathlib
import unittest import unittest
from glob import glob
from pyplaml import * from pyplaml import *
...@@ -8,8 +8,10 @@ from pyplaml import * ...@@ -8,8 +8,10 @@ from pyplaml import *
# noinspection PyBroadException # noinspection PyBroadException
class PyPlamlTest(unittest.TestCase): class PyPlamlTest(unittest.TestCase):
def setUp(self): def setUp(self):
puml_files = pathlib.Path(__file__).parent.parent / 'examples' / 'plantuml'
self.parser = PUMLParser() self.parser = PUMLParser()
self.examples_sorted = sorted(glob("../examples/plantuml/*.puml")) self.examples_sorted = sorted(puml_files.glob("*.puml"))
def test_lexer(self): def test_lexer(self):
for example_file in self.examples_sorted: for example_file in self.examples_sorted:
...@@ -23,9 +25,11 @@ class PyPlamlTest(unittest.TestCase): ...@@ -23,9 +25,11 @@ class PyPlamlTest(unittest.TestCase):
self.assertTrue(False, f"Parser exception in {example_file}") self.assertTrue(False, f"Parser exception in {example_file}")
def test_drawing(self): def test_drawing(self):
main_script = Path(__file__).parent.parent / 'main.py'
for e in self.examples_sorted: for e in self.examples_sorted:
self.assertEqual( self.assertEqual(
os.system("python ../main.py " + e), os.system(f"python {main_script} {e}"),
0, 0,
f"Drawing \"{e}\" failed" f"Drawing \"{e}\" failed"
) )
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment