MCPcopy Create free account
hub / github.com/MITK/MITK / EnsurePytestInstalled

Function EnsurePytestInstalled

Modules/Python/test/mitkPythonBindingsTest.cpp:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
68int mitkPythonBindingsTest(int, char*[])

Callers 1

mitkPythonBindingsTestFunction · 0.85

Calls 2

RunPythonCommandFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected