diff --git a/godot_parser/util.py b/godot_parser/util.py index 46783b1..74372f9 100644 --- a/godot_parser/util.py +++ b/godot_parser/util.py @@ -1,4 +1,5 @@ """ Utils """ + import json import os from typing import Optional @@ -27,9 +28,9 @@ def stringify_object(value): def find_project_root(start: str) -> Optional[str]: - curdir = start - if os.path.isfile(start): - curdir = os.path.dirname(start) + curdir = os.path.realpath(start) # Ensure start is a real path + if os.path.isfile(curdir): + curdir = os.path.dirname(curdir) while True: if os.path.isfile(os.path.join(curdir, "project.godot")): return curdir diff --git a/tests/test_tree.py b/tests/test_tree.py index 9cc1d65..8baea30 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -8,7 +8,6 @@ class TestTree(unittest.TestCase): - """Test the the high-level tree API""" def test_get_node(self): @@ -107,7 +106,6 @@ def test_dunder(self): class TestInheritedScenes(unittest.TestCase): - """Test the the high-level tree API for inherited scenes""" project_dir = None @@ -118,7 +116,7 @@ class TestInheritedScenes(unittest.TestCase): @classmethod def setUpClass(cls): super(TestInheritedScenes, cls).setUpClass() - cls.project_dir = tempfile.mkdtemp() + cls.project_dir = os.path.realpath(tempfile.mkdtemp()) with open( os.path.join(cls.project_dir, "project.godot"), "w", encoding="utf-8" ) as ofile: @@ -300,7 +298,6 @@ def test_missing_ext_resource(self): class TestUtil(unittest.TestCase): - """Tests for util""" def test_bad_gdpath(self):