Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
- python-version: '3.13'
toxenv: 'py313-test'

- python-version: '3.14'
toxenv: 'py314-test'

- python-version: 'pypy-3.11'
toxenv: 'pypy3-test'

Expand Down Expand Up @@ -65,7 +68,7 @@ jobs:
pip install -U pip # so that we can use wheels
# tox creates the sdist: we need cython to be installed in the env which
# creates the sdist, to generate the .c files
pip install tox==4.25.0 cython==3.0.12
pip install tox==4.25.0 cython==3.2.2

- name: Run tox
run: tox -e ${{ matrix.toxenv }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ schema: annotate
# run only python3 tests: this should good enough to be checked
# locally before pushing and run the whole tests on travis
test:
tox -e py37-test,py38-test
tox -e py38-test
6 changes: 6 additions & 0 deletions capnpy/_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ typedef struct {

// Use values / methods from CPython 3.5
#define HASH_MASK _PyHASH_MODULUS

// https://groups.google.com/g/cython-users/c/YQkU8oc8oSM/m/nVJ_IX8KAgAJ
#if PY_VERSION_HEX < 0x030E0000
#define strhash_f _Py_HashBytes
#else
#define strhash_f Py_HashBuffer
#endif

// Unused in Python 3, but has to exist during cython compilation
_Py_HashSecret_custom HashSecret;
Expand Down
21 changes: 15 additions & 6 deletions capnpy/testing/compiler/test_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ def initargs(self, request, tmpdir, monkeypatch):
monkeypatch.syspath_prepend(tmpdir)
self.imports = []

yield

# As of pytest 7.4, the way teardowns work has changed, meaning that
# we we do not have the same order about when the teardown code is run.
# Putting the teardown stuff in the `initargs` fixture after a `yield`
# statement does lead to a corret execution order, and it should work
# for older versions of pytest too.

# def teardown(self):
# remove the modules which we have imported for the test from
# sys.modules
for modname in self.imports:
del sys.modules[modname]


def compile(self, filename, src):
infile = self.write(filename, src.strip())
comp = StandaloneCompiler(sys.path)
Expand All @@ -22,12 +37,6 @@ def import_(self, modname):
self.imports.append(modname)
return mod

def teardown(self):
# remove the modules which we have imported for the test from
# sys.modules
for modname in self.imports:
del sys.modules[modname]

def test_compile_and_import(self):
self.compile("example.capnp", """
@0xbf5147cbbecf40c1;
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[tox]
# nopyx is a special env where Cython is NOT installed, and thus we run
# pure-python tests
envlist = py37-test,py38-test,py39-test,py310-test,py311-test,py312-test,py313-test,pypy-{test,bench},pypy3-{test},docs
envlist = py38-test,py39-test,py310-test,py311-test,py312-test,py313-test,py314-test,pypy-{test,bench},pypy3-{test},docs

[testenv]
setenv =
TOX_ENV={envname}

deps =
pytest==6.2.5
#git+https://github.com/antocuni/pytest-benchmark.git#egg=pytest-benchmark
pytest==6.2.5 ; python_version < "3.13"
pytest>=8.4.0 ; python_version >= "3.13"

commands =
test: py.test {envsitepackagesdir}/capnpy/testing -rs --pyx {posargs}
Expand Down