Skip to content

Commit 9ac0b9d

Browse files
committed
Help test runner find imports
1 parent f91a803 commit 9ac0b9d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

AddonManagerTest/run_all_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
22

3+
import os
34
import sys
45
import unittest
56

7+
# Ensure the tests can find the correct imports
8+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
9+
610
if __name__ == "__main__":
711
loader = unittest.TestLoader()
812
suite = loader.discover(start_dir=".", pattern="test_*.py")

AddonManagerTest/run_app_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
22

3+
import os
34
import sys
45
import unittest
56

7+
# Ensure the tests can find the correct imports
8+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
9+
610
if __name__ == "__main__":
711
loader = unittest.TestLoader()
812
suite = loader.discover(start_dir="app", pattern="test_*.py")

AddonManagerTest/run_gui_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
22

3+
import os
34
import sys
45
import unittest
56

7+
# Ensure the tests can find the correct imports
8+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
9+
610
if __name__ == "__main__":
711
loader = unittest.TestLoader()
812
suite = loader.discover(start_dir="gui", pattern="test_*.py")

0 commit comments

Comments
 (0)