Skip to content

Commit 07097dc

Browse files
authored
Merge pull request #47 from fanosta/run_tests_in_ci
Run tests in ci
2 parents 336aec8 + 21eeeb1 commit 07097dc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/newpython.yml

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
# to supply options, put them in 'env', like:
3636
env:
3737
CIBW_BEFORE_ALL_LINUX: yum install -y boost-devel zlib-devel
38+
CIBW_TEST_REQUIRES: pytest
39+
CIBW_TEST_COMMAND: "pytest --color=yes -v {project}/python/tests/test_pyapproxmc.py"
3840
CIBW_SKIP: "*musl*"
3941
CIBW_ARCHS: "auto64"
4042

python/tests/test_pyapproxmc.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
import sys
33
from array import array
4+
from pathlib import Path
45

56
import pytest
67

@@ -25,7 +26,8 @@ def test_sampling_set():
2526
def test_real_example():
2627
counter = Counter(seed=120, epsilon=0.8, delta=0.2)
2728

28-
with open("test_1.cnf") as test_cnf:
29+
cnf_file = Path(__file__).parent / "test_1.cnf"
30+
with open(cnf_file) as test_cnf:
2931
# Pop sampling set and metadata lines
3032
lines = test_cnf.readlines()[2:]
3133

@@ -51,7 +53,8 @@ def test_add_clauses_real_example():
5153
counter = Counter(seed=120, epsilon=0.8, delta=0.2)
5254
clauses = []
5355

54-
with open("test_1.cnf") as test_cnf:
56+
cnf_file = Path(__file__).parent / "test_1.cnf"
57+
with open((cnf_file)) as test_cnf:
5558
# Pop sampling set and metadata lines
5659
lines = test_cnf.readlines()[2:]
5760

@@ -67,4 +70,5 @@ def test_add_clauses_real_example():
6770

6871

6972
if __name__ == '__main__':
70-
pytest.main([__file__, '-v'] + sys.argv[1:])
73+
ret = pytest.main([__file__, '-v'] + sys.argv[1:])
74+
raise SystemExit(ret)

0 commit comments

Comments
 (0)