2021-06-23 10:47:18 -04:00
|
|
|
from typing import Dict
|
|
|
|
|
|
2020-12-21 11:06:25 +00:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
2021-06-23 10:47:18 -04:00
|
|
|
def pytest_addoption(parser) -> None:
|
2020-12-21 11:06:25 +00:00
|
|
|
parser.addoption(
|
|
|
|
|
"--run-emulation", action="store_true", default=False, help="run emulation tests"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pytest_configure(config):
|
|
|
|
|
config.addinivalue_line("markers", "emulation: mark test requiring qemu binfmt_misc to run")
|
|
|
|
|
|
|
|
|
|
|
2021-06-23 10:47:18 -04:00
|
|
|
def pytest_collection_modifyitems(config, items) -> None:
|
2020-12-21 11:06:25 +00:00
|
|
|
if config.getoption("--run-emulation"):
|
|
|
|
|
# --run-emulation given in cli: do not skip emulation tests
|
|
|
|
|
return
|
|
|
|
|
skip_emulation = pytest.mark.skip(reason="need --run-emulation option to run")
|
|
|
|
|
for item in items:
|
|
|
|
|
if "emulation" in item.keywords:
|
|
|
|
|
item.add_marker(skip_emulation)
|
2021-06-23 10:47:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(
|
|
|
|
|
params=[{"CIBW_BUILD_FRONTEND": "pip"}, {"CIBW_BUILD_FRONTEND": "build"}], ids=["pip", "build"]
|
|
|
|
|
)
|
|
|
|
|
def build_frontend_env(request) -> Dict[str, str]:
|
2021-10-16 21:31:20 -04:00
|
|
|
return request.param # type: ignore[no-any-return]
|