From 3ca6bd3340f4835149890119aeb0d7aa674e8b3b Mon Sep 17 00:00:00 2001 From: Andrew Dennison Date: Fri, 20 Oct 2023 10:41:29 +1100 Subject: [PATCH] test_targets: adjust to enumerate litex_boards module --- test/test_targets.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/test_targets.py b/test/test_targets.py index 81d036837..dbc8bdcb6 100644 --- a/test/test_targets.py +++ b/test/test_targets.py @@ -13,6 +13,11 @@ from migen import * from litex.soc.integration.builder import * +import os +import inspect +import litex_boards +litex_boards_path = os.path.dirname(inspect.getfile(litex_boards)) + class TestTargets(unittest.TestCase): excluded_platforms = [ "qmtech_daughterboard", # Reason: Not a real platform. @@ -46,7 +51,7 @@ class TestTargets(unittest.TestCase): def test_platforms(self): # Collect platforms. platforms = [] - for file in os.listdir("./litex_boards/platforms/"): + for file in os.listdir(f"{litex_boards_path}/platforms/"): if file.endswith(".py"): file = file.replace(".py", "") if file not in ["__init__"] + self.excluded_platforms: @@ -68,7 +73,7 @@ python3 -m litex_boards.targets.simple litex_boards.platforms.{} \ def test_targets(self): # Collect targets. targets = [] - for file in os.listdir("./litex_boards/targets/"): + for file in os.listdir(f"{litex_boards_path}/targets/"): if file.endswith(".py"): file = file.replace(".py", "") if file not in ["__init__"] + self.excluded_targets: