ci: pytest idf ci could accept "--target" as uppercase
@@ -22,6 +22,7 @@ from typing import Callable, List, Optional
import pytest
from _pytest.config import Config
from _pytest.fixtures import FixtureRequest
+from _pytest.main import Session
from _pytest.nodes import Item
from _pytest.python import Function
from pytest_embedded.plugin import parse_configuration
@@ -95,7 +96,7 @@ def build_dir(
"""
param_or_cli: str = getattr(
request, 'param', None
- ) or request.config.option.__dict__.get('build_dir')
+ ) or request.config.getoption('build_dir')
if param_or_cli is not None: # respect the param and the cli
return param_or_cli
@@ -146,6 +147,12 @@ def pytest_addoption(parser: pytest.Parser) -> None:
)
+@pytest.hookimpl(tryfirst=True)
+def pytest_sessionstart(session: Session) -> None:
+ if session.config.option.target:
+ session.config.option.target = session.config.getoption('target').lower()
+
+
@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(config: Config, items: List[Function]) -> None:
target = config.getoption('target', None) # use the `build` dir
