diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16d6a88f..0f213e47 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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' @@ -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 }} diff --git a/Makefile b/Makefile index b09db969..d396ca19 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/capnpy/_hash.h b/capnpy/_hash.h index 18f29f17..dcbda235 100644 --- a/capnpy/_hash.h +++ b/capnpy/_hash.h @@ -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; diff --git a/capnpy/testing/compiler/test_standalone.py b/capnpy/testing/compiler/test_standalone.py index 7eb8ded3..459cddd0 100644 --- a/capnpy/testing/compiler/test_standalone.py +++ b/capnpy/testing/compiler/test_standalone.py @@ -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) @@ -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; diff --git a/tox.ini b/tox.ini index be29406b..4aa903c5 100644 --- a/tox.ini +++ b/tox.ini @@ -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}