| 45 | } |
| 46 | |
| 47 | void EnsurePytestInstalled() |
| 48 | { |
| 49 | const auto pythonExecutable = mitk::PythonHelper::GetExecutablePath(); |
| 50 | MITK_TEST_CONDITION_REQUIRED(!pythonExecutable.empty(), "Virtual environment Python executable is available") |
| 51 | |
| 52 | if (RunPythonCommand(pythonExecutable, {"-c", "\"import pytest, jsonschema\""}) == 0) |
| 53 | { |
| 54 | MITK_INFO << "pytest and jsonschema are already present in the dedicated test virtual environment."; |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | MITK_TEST_CONDITION_REQUIRED( |
| 59 | RunPythonCommand(pythonExecutable, {"-m", "ensurepip", "--upgrade"}) == 0, |
| 60 | "Bootstrapping pip in the dedicated test virtual environment") |
| 61 | |
| 62 | MITK_TEST_CONDITION_REQUIRED( |
| 63 | RunPythonCommand(pythonExecutable, {"-m", "pip", "install", "--disable-pip-version-check", "pytest", "jsonschema"}) == 0, |
| 64 | "Installing pytest and jsonschema in the dedicated test virtual environment") |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | int mitkPythonBindingsTest(int, char*[]) |
no test coverage detected