diff --git a/tests/v3/compatibility-suite/__init__.py b/tests/v3/compatibility-suite/__init__.py new file mode 100644 index 0000000000..16228019ee --- /dev/null +++ b/tests/v3/compatibility-suite/__init__.py @@ -0,0 +1,3 @@ +""" +Compatibility suite tests. +""" diff --git a/tests/v3/compatibility-suite/conftest.py b/tests/v3/compatibility-suite/conftest.py new file mode 100644 index 0000000000..46d3d33cb5 --- /dev/null +++ b/tests/v3/compatibility-suite/conftest.py @@ -0,0 +1,30 @@ +""" +Pytest configuration. + +As the compatibility suite makes use of a submodule, we need to make sure the +submodule has been initialized before running the tests. +""" + +import shutil +import subprocess +from pathlib import Path + +import pytest + + +@pytest.fixture(scope="session", autouse=True) +def _submodule_init() -> None: + """Initialize the submodule.""" + # Locate the git execute + submodule_dir = Path(__file__).parent / "definition" + if submodule_dir.is_dir(): + return + + git_exec = shutil.which("git") + if git_exec is None: + msg = ( + "Submodule not initialized and git executable not found." + " Please initialize the submodule with `git submodule init`." + ) + raise RuntimeError(msg) + subprocess.check_call([git_exec, "submodule", "init"]) # noqa: S603