Skip to content

Commit abae72b

Browse files
gchwierde-nordic
authored andcommitted
test: bootloader: pytest: Add python-devicetree to paths
Added python-devicetree to PYTHONPATH as edtlib is used in pytest. Signed-off-by: Grzegorz Chwierut <[email protected]>
1 parent e19038d commit abae72b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/subsys/bootloader/upgrade/pytest/parameters.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@
77
from __future__ import annotations
88

99
import logging
10+
import os
1011
import pickle
12+
import sys
1113
from dataclasses import dataclass, field
1214
from pathlib import Path
1315

14-
import devicetree.edtlib
1516
from imgtool_wrapper import ImgtoolParams
1617
from twister_harness.helpers.utils import find_in_config
1718

19+
# This is needed to load edt.pickle files.
20+
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
21+
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts", "dts", "python-devicetree", "src"))
22+
from devicetree import edtlib # type: ignore # noqa: E402
23+
1824
logger = logging.getLogger(__name__)
1925

2026

21-
def get_edt_node(edt_data: Path, node_label: str) -> devicetree.edtlib.EDTNode: # type: ignore
27+
def get_edt_node(edt_data: Path, node_label: str) -> edtlib.EDTNode: # type: ignore
2228
"""Parse the EDT pickle file and return a node by its label.
2329
2430
Args:

0 commit comments

Comments
 (0)