Skip to content

Commit 0d94852

Browse files
committed
Search for additional tests in correct path
Protoplaster was always searching in the default `CONFIG_DIR`, ignoring the -d flag. This commit adds passing actual test dir location to the `Test` class, so it will search in the correct place. Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
1 parent b2203b7 commit 0d94852

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

protoplaster/conf/parser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import yaml
88

9-
from protoplaster.conf.consts import CONFIG_DIR
109
from protoplaster.tests.i2c.test import __file__ as i2c_test
1110
from protoplaster.tests.gpio.gpio.test import __file__ as gpio_test
1211
from protoplaster.tests.camera.test import __file__ as camera_test
@@ -111,7 +110,7 @@ class Test(ConfigObj):
111110
body: list[TestBody]
112111

113112
def __init__(self, origin: Path, name: str, content: dict[str, Any],
114-
custom_path: StrPath) -> None:
113+
test_dir: StrPath, custom_path: StrPath) -> None:
115114
self.name = name
116115
self.origin = origin
117116
self.body = list()
@@ -122,7 +121,7 @@ def __init__(self, origin: Path, name: str, content: dict[str, Any],
122121
if module_name in test_modules_paths:
123122
params = wrap_list(params)
124123
elif (module_path :=
125-
to_path(CONFIG_DIR) / module_name).exists() and load_module(
124+
to_path(test_dir) / module_name).exists() and load_module(
126125
module_path, module_name):
127126
params = wrap_list(params)
128127
elif custom_path.exists() and load_module(custom_path,
@@ -260,14 +259,15 @@ def __init__(
260259

261260
if (tests := file_content.get("tests")) is not None:
262261
for name, content in tests.items():
263-
test = Test(self.file, name, content, custom_path)
262+
test = Test(self.file, name, content, test_dir, custom_path)
264263

265264
if name in self.tests.keys():
266265
pr_warn(
267266
f'{test.module_path()}: test redefined (previous definition in {self.tests[name].module_path()})'
268267
)
269268

270-
self.tests[name] = Test(self.file, name, content, custom_path)
269+
self.tests[name] = Test(self.file, name, content, test_dir,
270+
custom_path)
271271

272272
if (metadata := file_content.get("metadata")) is not None:
273273
for name, content in metadata.items():

0 commit comments

Comments
 (0)