Skip to content

Commit 03fd99c

Browse files
committed
Set PROJECT_DIR variable for unittest tests.
1 parent 6dda0bf commit 03fd99c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

backends/nxp/tests/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# TODO(Robert Kalmar) In accordance with the "TODO(dbort): Prune /test[s]/ dirs, /third-party/ dirs" in pyproject.toml,
1616
# once the test folders are not installed we can derive the path from current file location: `pathlib.Path(__file__)`
1717
PROJECT_DIR = os.environ.get("PROJECT_DIR")
18+
if not PROJECT_DIR:
19+
# Auto-detect: The PROJECT_DIR env variable is set by the conftest.py in backends.nxp.tests.conftest. But unittests
20+
# don't use the conftest, so this variable is not set -> set it manually here in that case.
21+
PROJECT_DIR = str(pathlib.Path(__file__).parent.parent.parent.parent)
1822
assert PROJECT_DIR and os.path.exists(
1923
PROJECT_DIR
2024
), f"Invalid PROJECT_DIR env variable: `{PROJECT_DIR}`."

0 commit comments

Comments
 (0)