Skip to content

Commit 4bfe50f

Browse files
authored
tests : check the Python version (ggml-org#7872)
ggml-ci
1 parent bdcb8f4 commit 4bfe50f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test-json-schema-to-grammar.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -870,15 +870,15 @@ int main() {
870870
}
871871
});
872872

873-
if (getenv("LLAMA_PYTHON_AVAILABLE") || (std::system("python --version") == 0)) {
873+
if (getenv("LLAMA_PYTHON_AVAILABLE") || (std::system("python -c \"import sys; exit(1) if sys.version_info < (3, 8) else print('Python version is sufficient')\"") == 0)) {
874874
test_all("Python", [](const TestCase & tc) {
875875
write("test-json-schema-input.tmp", tc.schema);
876876
tc.verify_status(std::system(
877877
"python ./examples/json_schema_to_grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
878878
tc.verify(read("test-grammar-output.tmp"));
879879
});
880880
} else {
881-
fprintf(stderr, "\033[33mWARNING: Python not found, skipping Python JSON schema -> grammar tests.\n\033[0m");
881+
fprintf(stderr, "\033[33mWARNING: Python not found (min version required is 3.8), skipping Python JSON schema -> grammar tests.\n\033[0m");
882882
}
883883

884884
if (getenv("LLAMA_NODE_AVAILABLE") || (std::system("node --version") == 0)) {

0 commit comments

Comments
 (0)