Skip to content

Commit c9d7831

Browse files
committed
added tests to CI to verify xorsat installs
1 parent b606e37 commit c9d7831

2 files changed

Lines changed: 28 additions & 8 deletions

File tree

.github/workflows/qokit-package.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
os: [ubuntu-latest, macos-latest]
2020
python-version: ["3.10", "3.11"]
21-
21+
2222
steps:
2323
- uses: actions/checkout@v3
2424
- name: Set up Python ${{ matrix.python-version }}
@@ -33,18 +33,22 @@ jobs:
3333
- name: black check
3434
run: |
3535
black --check .
36-
37-
- name: pip install
36+
37+
- name: pip install
38+
run: |
39+
pip install .
40+
41+
- name: Verify xorsat-optimize extra installs cleanly
3842
run: |
39-
pip install .
40-
41-
- name: Run tests
43+
pip install '.[xorsat-optimize]'
44+
45+
- name: Run tests
4246
run: |
43-
pytest --cov=qokit --cov-fail-under=75 -rs tests
47+
pytest --cov=qokit --cov-fail-under=75 -rs tests
4448
- name: License check
4549
run: |
4650
pip-licenses --format=markdown --order=license
47-
51+
4852
- name: SPDX check
4953
run: |
5054
addheader -t header.txt .

tests/test_max_k_xor_sat.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# // Copyright : JP Morgan Chase & Co
44
###############################################################################
55
"""Tests for the max_k_xor_sat module."""
6+
import importlib.metadata
67
import numpy as np
78
import pytest
89

@@ -203,6 +204,21 @@ def test_load_nonexistent_config():
203204
load_precomputed_results(99, 99)
204205

205206

207+
def test_xorsat_optimize_dep_name():
208+
"""xorsat-optimize must declare 'Py-BOBYQA' """
209+
requires = importlib.metadata.requires("qokit") or []
210+
bobyqa_deps = [r for r in requires if "bobyqa" in r.lower()]
211+
assert bobyqa_deps, "No bobyqa dependency found in qokit metadata"
212+
for dep in bobyqa_deps:
213+
pkg = dep.split(";")[0].strip().split()[0].lower()
214+
assert pkg != "pybobyqa", (
215+
f"Dependency '{dep}' uses the typo'd name 'pybobyqa' — use 'Py-BOBYQA' instead"
216+
)
217+
assert pkg in ("py-bobyqa", "py_bobyqa"), (
218+
f"Unexpected bobyqa dependency name '{pkg}' — expected 'py-bobyqa'"
219+
)
220+
221+
206222
# ============================================================
207223
# C++ backend tests
208224
# ============================================================

0 commit comments

Comments
 (0)