Skip to content

Commit 13a4469

Browse files
committed
Add CI testing for a older version of MiniZinc
1 parent 1e02528 commit 13a4469

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
python-version: ["3.7", "3.10", "pypy3.7"]
15-
minizinc-version: ["2.7.0"]
15+
minizinc-version: ["2.7.0", "2.5.4"]
1616

1717
env:
1818
MINIZINC_URL: https://github.com/MiniZinc/MiniZincIDE/releases/download/${{ matrix.minizinc-version }}/MiniZincIDE-${{ matrix.minizinc-version }}-x86_64.AppImage

tests/test_solving.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_empty(self):
128128

129129

130130
class FromAsync(InstanceTestCase):
131-
code = """int: x ::output = 5;"""
131+
code = """int: x ::add_to_output = 5;"""
132132

133133
def test_async_error(self):
134134
async def bad_run():

tests/test_types.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77
from support import InstanceTestCase
88

9-
from minizinc import Instance
9+
from minizinc import Instance, default_driver
1010
from minizinc.result import Status
1111
from minizinc.types import AnonEnum, ConstrEnum
1212

@@ -105,6 +105,10 @@ def test_intenum_collections(self):
105105
# TODO: assert result["arr_t"] == [TT(3), TT(2), TT(1)]
106106
assert result["set_t"] == {TT(1), TT(2)}
107107

108+
@pytest.mark.skipif(
109+
default_driver is None or default_driver.parsed_version < (2, 6, 0),
110+
reason="requires MiniZinc 2.6 or higher",
111+
)
108112
def test_constructor_enum(self):
109113
self.instance = Instance(self.solver)
110114
self.instance.add_string(
@@ -121,6 +125,10 @@ def test_constructor_enum(self):
121125
assert result["x"] == ConstrEnum("X", 2)
122126
assert str(result["x"]) == "X(2)"
123127

128+
@pytest.mark.skipif(
129+
default_driver is None or default_driver.parsed_version < (2, 6, 0),
130+
reason="requires MiniZinc 2.6 or higher",
131+
)
124132
def test_anon_enum(self):
125133
self.instance = Instance(self.solver)
126134
self.instance.add_string(
@@ -183,6 +191,10 @@ def test_string(self):
183191

184192

185193
class TestTuple(InstanceTestCase):
194+
@pytest.mark.skipif(
195+
default_driver is None or default_driver.parsed_version < (2, 7, 0),
196+
reason="requires MiniZinc 2.7 or higher",
197+
)
186198
def test_simple_tuple(self):
187199
self.instance.add_string(
188200
"""
@@ -199,6 +211,10 @@ def test_simple_tuple(self):
199211
assert isinstance(tup[2], float)
200212
assert 1.0 <= tup[2] and tup[2] <= 3.0
201213

214+
@pytest.mark.skipif(
215+
default_driver is None or default_driver.parsed_version < (2, 7, 0),
216+
reason="requires MiniZinc 2.7 or higher",
217+
)
202218
def test_rec_tuple(self):
203219
self.instance.add_string(
204220
"""
@@ -221,7 +237,12 @@ def test_rec_tuple(self):
221237

222238

223239
class TestRecord(InstanceTestCase):
240+
@pytest.mark.skipif(
241+
default_driver is None or default_driver.parsed_version < (2, 7, 0),
242+
reason="requires MiniZinc 2.7 or higher",
243+
)
224244
def test_simple_record(self):
245+
pytest.skip
225246
self.instance.add_string(
226247
"""
227248
var record(1..3: a, bool: b, 1.0..3.0: c): x;
@@ -237,6 +258,10 @@ def test_simple_record(self):
237258
assert isinstance(rec["c"], float)
238259
assert 1.0 <= rec["c"] and rec["c"] <= 3.0
239260

261+
@pytest.mark.skipif(
262+
default_driver is None or default_driver.parsed_version < (2, 7, 0),
263+
reason="requires MiniZinc 2.7 or higher",
264+
)
240265
def test_rec_record(self):
241266
self.instance.add_string(
242267
"""
@@ -345,12 +370,20 @@ def test_npint64(self):
345370

346371

347372
class TestAnn(InstanceTestCase):
373+
@pytest.mark.skipif(
374+
default_driver is None or default_driver.parsed_version < (2, 6, 0),
375+
reason="requires MiniZinc 2.6 or higher",
376+
)
348377
def test_ann_atom(self):
349378
self.instance.add_string("ann: x :: add_to_output = promise_total;")
350379
result = self.instance.solve()
351380
assert result.status is Status.SATISFIED
352381
assert result["x"] == "promise_total"
353382

383+
@pytest.mark.skipif(
384+
default_driver is None or default_driver.parsed_version < (2, 6, 0),
385+
reason="requires MiniZinc 2.6 or higher",
386+
)
354387
def test_ann_call(self):
355388
self.instance.add_string('ann: x :: add_to_output = expression_name("test");')
356389
result = self.instance.solve()

0 commit comments

Comments
 (0)