Skip to content

Commit c85d324

Browse files
committed
test both cythonised and pure-Python
1 parent 7347a23 commit c85d324

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

.github/workflows/cis.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,13 @@ jobs:
3636
tox
3737
3838
tests:
39-
name: Unit tests
39+
name: "Unit tests (Python ${{ matrix.python-version }}, ${{ matrix.pure_python && 'pure' || 'cython' }})"
4040
runs-on: ubuntu-latest
4141
strategy:
4242
fail-fast: false
4343
matrix:
44-
include:
45-
- python-version: "3.11"
46-
toxenv: py311
47-
- python-version: "3.12"
48-
toxenv: py312
49-
- python-version: "3.13"
50-
toxenv: py313
51-
- python-version: "3.14"
52-
toxenv: py314
44+
python-version: ["3.11", "3.12", "3.13", "3.14"]
45+
pure_python: ["", "1"]
5346
steps:
5447
- uses: actions/checkout@v6
5548
- name: Get history and tags for SCM versioning to work
@@ -66,9 +59,9 @@ jobs:
6659
python -m pip install tox
6760
- name: Test
6861
env:
69-
TOXENV: ${{ matrix.toxenv }}
62+
BYTECODE_PURE_PYTHON: ${{ matrix.pure_python }}
7063
run: |
71-
tox
64+
tox -e py$(echo '${{ matrix.python-version }}' | tr -d .)
7265
- name: Upload coverage to Codecov
7366
uses: codecov/codecov-action@v6
7467
if: github.event_name != 'schedule'

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def pretend_cython():
2929

3030

3131
_pure_python = os.getenv("BYTECODE_PURE_PYTHON")
32+
print(f"bytecode: building {'pure-Python' if _pure_python else 'Cython'} version")
3233

3334
setup(
3435
name="bytecode",

tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import bytecode
2+
3+
4+
def pytest_report_header():
5+
import importlib.util
6+
7+
spec = importlib.util.find_spec("bytecode.concrete")
8+
kind = "pure-Python" if (spec and spec.origin and spec.origin.endswith(".py")) else "Cython"
9+
return f"bytecode: {kind} build ({bytecode.__file__})"

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ envlist = py3, py38, py39, py310, py311, py312, py313, py314, fmt, docs
33
isolated_build = true
44

55
[testenv]
6+
passenv = BYTECODE_PURE_PYTHON
67
deps=
78
pytest
89
pytest-cov

0 commit comments

Comments
 (0)