Skip to content

Commit ccd160d

Browse files
committed
Fix guard for numpy test
1 parent add4bcc commit ccd160d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyomo/core/tests/unit/test_numpy_expr.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ def test_indexed_constraint(self):
262262
)
263263
)
264264

265-
@unittest.skipUnless(int(np.__version__.split('.')[0]) >= 2, "requires numpy>=2")
266265
def test_numpy_array_copy_errors(self):
266+
# Defer testing until here to avoid the unconditional numpy dereference
267+
if int(np.__version__.split('.')[0]) < 2:
268+
self.SkipTest("requires numpy>=2")
269+
267270
m = ConcreteModel()
268271
m.x = Var([0, 1, 2])
269272
with self.assertRaisesRegex(

0 commit comments

Comments
 (0)