Skip to content

Commit 0640ed5

Browse files
authored
test: Silence SyntaxWarning when importing highspy (#531)
1 parent 2c2a58f commit 0640ed5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import random as rand
2+
import warnings
23
from contextlib import nullcontext
34

45
import torch
@@ -7,6 +8,12 @@
78
from torch import Tensor
89
from utils.architectures import ModuleFactory
910

11+
# Because of a SyntaxWarning raised when compiling highspy, we have to filter SyntaxWarning here.
12+
# It seems that the standard ways of ignoring warnings in pytest do not work, because the problem
13+
# is already triggered in the conftest.py itself. This line could be removed when
14+
# https://github.com/ERGO-Code/HiGHS/issues/2777 is fixed and the fix is released.
15+
warnings.filterwarnings("ignore", category=SyntaxWarning)
16+
1017
from torchjd.aggregation import Aggregator, Weighting
1118

1219

0 commit comments

Comments
 (0)