Skip to content

Commit 6b3e484

Browse files
committed
test: Silence SyntaxWarning when importing highspy
1 parent 2c2a58f commit 6b3e484

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import random as rand
2+
3+
# Because of a SyntaxWarning raised when compiling highspy, we have to filter SyntaxWarning here.
4+
# It seems that the standard ways of ignoring warnings in pytest do not work, because the problem
5+
# is already triggered in the conftest.py itself. These two lines could be removed when
6+
# https://github.com/ERGO-Code/HiGHS/issues/2777 is fixed and the fix is released.
7+
import warnings
28
from contextlib import nullcontext
39

410
import torch
@@ -7,6 +13,8 @@
713
from torch import Tensor
814
from utils.architectures import ModuleFactory
915

16+
warnings.filterwarnings("ignore", category=SyntaxWarning)
17+
1018
from torchjd.aggregation import Aggregator, Weighting
1119

1220

0 commit comments

Comments
 (0)