Skip to content

Tests crash on Python 3.13.3 #78

Description

@mgorny

Note that I had to remove nose references since it doesn't work on Python 3.10+. So to run the test suite, I first did:

diff --git a/tests/unit/test_forbidden_fruit.py b/tests/unit/test_forbidden_fruit.py
index f8a1b62..104c751 100644
--- a/tests/unit/test_forbidden_fruit.py
+++ b/tests/unit/test_forbidden_fruit.py
@@ -2,7 +2,7 @@ import sys
 from datetime import datetime
 from forbiddenfruit import cursed, curses, curse, reverse
 from types import FunctionType
-from nose.tools import nottest, istest
+import pytest
 
 # Our stub! :)
 from . import ffruit
@@ -14,7 +14,8 @@ def almost_equal(a, b, e=0.001):
     return abs(a - b) < e
 
 
-skip_legacy = nottest if sys.version_info < (3, 3) else istest
+skip_legacy = pytest.mark.skipif(sys.version_info < (3, 3),
+                                 reason="legacy python test")
 
 def test_cursing_a_builtin_class():
 

Then:

$ uv venv -p 3.13
Using CPython 3.13.3 interpreter at: /usr/bin/python3.13
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
$ . .venv/bin/activate
$ uv pip install -e . pytest setuptools
Resolved 6 packages in 832ms
      Built forbiddenfruit @ file:///tmp/forbiddenfruit
Prepared 1 package in 551ms
░░░░░░░░░░░░░░░░░░░░ [0/6] Installing wheels...                                                                                        warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 6 packages in 14ms
 + forbiddenfruit==0.1.4 (from file:///tmp/forbiddenfruit)
 + iniconfig==2.1.0
 + packaging==25.0
 + pluggy==1.6.0
 + pytest==8.3.5
 + setuptools==80.8.0
$ make build_test_stub
/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

        ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:

        License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
        License :: OSI Approved :: MIT License

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!
  self._finalize_license_expression()
running build
running build_py
creating build/lib.linux-x86_64-cpython-313/forbiddenfruit
copying forbiddenfruit/__init__.py -> build/lib.linux-x86_64-cpython-313/forbiddenfruit
running build_ext
building 'ffruit' extension
creating build/temp.linux-x86_64-cpython-313/tests/unit
x86_64-pc-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -fPIC -I/tmp/forbiddenfruit/.venv/include -I/usr/include/python3.13 -c tests/unit/ffruit.c -o build/temp.linux-x86_64-cpython-313/tests/unit/ffruit.o
x86_64-pc-linux-gnu-gcc -shared build/temp.linux-x86_64-cpython-313/tests/unit/ffruit.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-313/ffruit.cpython-313-x86_64-linux-gnu.so
$ pytest -s
========================================================= test session starts =========================================================
platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.6.0
rootdir: /tmp/forbiddenfruit
collected 24 items                                                                                                                    

tests/unit/test_forbidden_fruit.py python3: Objects/typeobject.c:1004: type_modified_unlocked: Assertion `(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) == 0' failed.
Fatal Python error: Aborted

Current thread 0x00007fca242a8bc0 (most recent call first):
  File "/tmp/forbiddenfruit/forbiddenfruit/__init__.py", line 472 in curse
  File "/tmp/forbiddenfruit/tests/unit/test_forbidden_fruit.py", line 27 in test_cursing_a_builtin_class
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/python.py", line 159 in pytest_pyfunc_call
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/python.py", line 1627 in runtest
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/runner.py", line 174 in pytest_runtest_call
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/runner.py", line 242 in <lambda>
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/runner.py", line 341 in from_call
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/runner.py", line 241 in call_and_report
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/runner.py", line 132 in runtestprotocol
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/runner.py", line 113 in pytest_runtest_protocol
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/main.py", line 362 in pytest_runtestloop
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/main.py", line 337 in _main
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/main.py", line 283 in wrap_session
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/main.py", line 330 in pytest_cmdline_main
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_callers.py", line 121 in _multicall
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/pluggy/_hooks.py", line 512 in __call__
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/config/__init__.py", line 175 in main
  File "/tmp/forbiddenfruit/.venv/lib/python3.13/site-packages/_pytest/config/__init__.py", line 201 in console_main
  File "/tmp/forbiddenfruit/.venv/bin/pytest", line 10 in <module>

Extension modules: tests.unit.ffruit (total: 1)
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions