From 42c4c63cc403d2ce60f9e5a4d0ec31c20082b65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Wed, 28 Jan 2026 01:08:51 +0100 Subject: [PATCH] test: Silence SyntaxWarning when importing highspy --- tests/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index a2921520..06c3d98b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import random as rand +import warnings from contextlib import nullcontext import torch @@ -7,6 +8,12 @@ from torch import Tensor from utils.architectures import ModuleFactory +# Because of a SyntaxWarning raised when compiling highspy, we have to filter SyntaxWarning here. +# It seems that the standard ways of ignoring warnings in pytest do not work, because the problem +# is already triggered in the conftest.py itself. This line could be removed when +# https://github.com/ERGO-Code/HiGHS/issues/2777 is fixed and the fix is released. +warnings.filterwarnings("ignore", category=SyntaxWarning) + from torchjd.aggregation import Aggregator, Weighting