Skip to content

Test failures on Python 3.13.3 freethreaded #150

@mgorny

Description

@mgorny

When testing the newly-added freethreading support, I'm seeing the following test failures:

$ tox -e 3.13t
.pkg: _optional_hooks> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_wheel> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: prepare_metadata_for_build_wheel> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
3.13t: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/py-setproctitle/.tox/.tmp/package/3/setproctitle-1.3.6.tar.gz
3.13t: commands[0]> pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.5.0
cachedir: .tox/3.13t/.pytest_cache
rootdir: /tmp/py-setproctitle
configfile: pyproject.toml
collected 28 items                                                                                                                    

tests/module_test.py ...                                                                                                        [ 10%]
tests/setproctitle_test.py ...s.........FF.....                                                                                 [ 82%]
tests/setthreadtitle_test.py ...                                                                                                [ 92%]
tests/test_win32.py ss                                                                                                          [100%]

============================================================== FAILURES ===============================================================
____________________________________________________________ test_embedded ____________________________________________________________

pyrun = '/tmp/py-setproctitle/tests/pyrun3.13', spt_directory = '/tmp/py-setproctitle/.tox/3.13t/lib/python3.13t/site-packages'

    @pytest.mark.embedded
    @skip_if_pypy
    @skip_if_macos
    @skip_if_no_proc_cmdline
    def test_embedded(pyrun, spt_directory):
        """Check the module works with embedded Python."""
        rv = run_script(
            f"""
    import sys
    sys.path.insert(0, {spt_directory!r})
    import setproctitle
    setproctitle.setproctitle("Hello, embedded!")
    
    import os
    print(os.getpid())
    print(os.popen("ps -x -o pid,command 2> /dev/null").read())
    """,
            executable=pyrun,
        )
        lines = [line for line in rv.splitlines() if line]
        pid = lines.pop(0)
        pids = dict([r.strip().split(None, 1) for r in lines])
    
        title = _clean_up_title(pids[pid])
>       assert title == "Hello, embedded!"
E       AssertionError: assert '/tmp/py-setp...sts/pyrun3.13' == 'Hello, embedded!'
E         
E         - Hello, embedded!
E         + /tmp/py-setproctitle/tests/pyrun3.13

tests/setproctitle_test.py:362: AssertionError
_______________________________________________________ test_embedded_many_args _______________________________________________________

pyrun = '/tmp/py-setproctitle/tests/pyrun3.13', spt_directory = '/tmp/py-setproctitle/.tox/3.13t/lib/python3.13t/site-packages'

    @pytest.mark.embedded
    @skip_if_pypy
    @skip_if_macos
    @skip_if_no_proc_cmdline
    def test_embedded_many_args(pyrun, spt_directory):
        """Check more complex cmdlines are handled in embedded env too."""
        rv = run_script(
            f"""
    import sys
    sys.path.insert(0, {spt_directory!r})
    import setproctitle
    setproctitle.setproctitle("Hello, embedded!")
    
    import os
    print(os.getpid())
    print(os.popen("ps -x -o pid,command 2> /dev/null").read())
    """,
            executable=pyrun,
            args=" ".join(["foo", "bar", "baz"]),
        )
        lines = [line for line in rv.splitlines() if line]
        pid = lines.pop(0)
        pids = dict([r.strip().split(None, 1) for r in lines])
    
        title = _clean_up_title(pids[pid])
>       assert title == "Hello, embedded!"
E       AssertionError: assert '/tmp/py-setp...3 foo bar baz' == 'Hello, embedded!'
E         
E         - Hello, embedded!
E         + /tmp/py-setproctitle/tests/pyrun3.13 foo bar baz

tests/setproctitle_test.py:390: AssertionError
======================================================= short test summary info =======================================================
FAILED tests/setproctitle_test.py::test_embedded - AssertionError: assert '/tmp/py-setp...sts/pyrun3.13' == 'Hello, embedded!'
FAILED tests/setproctitle_test.py::test_embedded_many_args - AssertionError: assert '/tmp/py-setp...3 foo bar baz' == 'Hello, embedded!'
=============================================== 2 failed, 23 passed, 3 skipped in 1.33s ===============================================
3.13t: exit 1 (1.54 seconds) /tmp/py-setproctitle> pytest pid=266862
  3.13t: FAIL code 1 (5.71=setup[4.17]+cmd[1.54] seconds)
  evaluation failed :( (5.79 seconds)

For comparison, tox -e 3.13 passes. I can reproduce both with 1.3.6 release and 11d5ba7. That said, I have no clue why it passes on CI and not for me. The library is definitely there:

>>> import setproctitle._setproctitle
>>> setproctitle._setproctitle
<module 'setproctitle._setproctitle' from '/tmp/py-setproctitle/.tox/3.13t/lib/python3.13t/site-packages/setproctitle/_setproctitle.cpython-313t-x86_64-linux-gnu.so'>

This is Gentoo Linux amd64.

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