Skip to content

Commit

Permalink
Merge pull request #47 from fanosta/run_tests_in_ci
Browse files Browse the repository at this point in the history
Run tests in ci
  • Loading branch information
msoos authored Dec 22, 2023
2 parents 336aec8 + 21eeeb1 commit 07097dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/newpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
# to supply options, put them in 'env', like:
env:
CIBW_BEFORE_ALL_LINUX: yum install -y boost-devel zlib-devel
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest --color=yes -v {project}/python/tests/test_pyapproxmc.py"
CIBW_SKIP: "*musl*"
CIBW_ARCHS: "auto64"

Expand Down
10 changes: 7 additions & 3 deletions python/tests/test_pyapproxmc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys
from array import array
from pathlib import Path

import pytest

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

with open("test_1.cnf") as test_cnf:
cnf_file = Path(__file__).parent / "test_1.cnf"
with open(cnf_file) as test_cnf:
# Pop sampling set and metadata lines
lines = test_cnf.readlines()[2:]

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

with open("test_1.cnf") as test_cnf:
cnf_file = Path(__file__).parent / "test_1.cnf"
with open((cnf_file)) as test_cnf:
# Pop sampling set and metadata lines
lines = test_cnf.readlines()[2:]

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


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

0 comments on commit 07097dc

Please sign in to comment.