Skip to content

3.13 support + fix broken tests #78

@rosset

Description

@rosset

Hi, please add support for the upcoming Python 3.13 version.
Thanks!

Python 3.13.0rc1

  • /usr/bin/python3 /usr/lib/rpm/redhat/pyproject_save_files.py --output-files /builddir/build/BUILD/python-pdir2-1.1.0-build/python-pdir2-1.1.0-1.fc41.x86_64-pyproject-files --output-modules /builddir/build/BUILD/python-pdir2-1.1.0-build/python-pdir2-1.1.0-1.fc41.x86_64-pyproject-modules --buildroot /builddir/build/BUILD/python-pdir2-1.1.0-build/BUILDROOT --sitelib /usr/lib/python3.13/site-packages --sitearch /usr/lib64/python3.13/site-packages --python-version 3.13 --pyproject-record /builddir/build/BUILD/python-pdir2-1.1.0-build/python-pdir2-1.1.0-1.fc41.x86_64-pyproject-record --prefix /usr pdir
  • CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '
  • LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes '
  • PATH=/builddir/build/BUILD/python-pdir2-1.1.0-build/BUILDROOT/usr/bin:/usr/lib64/ccache:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
  • PYTHONPATH=/builddir/build/BUILD/python-pdir2-1.1.0-build/BUILDROOT/usr/lib64/python3.13/site-packages:/builddir/build/BUILD/python-pdir2-1.1.0-build/BUILDROOT/usr/lib/python3.13/site-packages
  • PYTHONDONTWRITEBYTECODE=1
  • PYTEST_ADDOPTS=' --ignore=/builddir/build/BUILD/python-pdir2-1.1.0-build/pdir2-1.1.0/.pyproject-builddir'
  • PYTEST_XDIST_AUTO_NUM_WORKERS=36
  • /usr/bin/pytest
    ============================= test session starts ==============================
    platform linux -- Python 3.13.0rc1, pytest-8.3.1, pluggy-1.5.0
    rootdir: /builddir/build/BUILD/python-pdir2-1.1.0-build/pdir2-1.1.0
    configfile: pyproject.toml
    plugins: hypothesis-6.104.2, xdist-3.6.1, cov-4.0.0, timeout-2.3.1
    collected 46 items

tests/test_buggy_attrs.py s..... [ 13%]
tests/test_container.py ... [ 19%]
tests/test_disbale_color.py . [ 21%]
tests/test_filters.py F..F... [ 36%]
tests/test_pdir_format.py ....F....... [ 63%]
tests/test_search.py .F [ 67%]
tests/test_slots.py ... [ 73%]
tests/test_user_config.py ............ [100%]

=================================== FAILURES ===================================
_______________________________ test_properties ________________________________

def test_properties():
  check_items_equality(
        [p.name for p in pdir(inst).properties.pattrs],
        [
            'base_class_variable',
            'base_instance_variable',
            'derived_class_variable',
            'derived_instance_variable',
            '__class__',
            '__dict__',
            '__doc__',
            '__module__',
            '__weakref__',
        ],
    )

tests/test_filters.py:44:


first = Counter({'class': 1, 'dict': 1, 'doc': 1, 'firstlineno': 1, 'module': 1, 'static_attributes': ...1, 'base_class_variable': 1, 'base_instance_variable': 1, 'derived_class_variable': 1, 'derived_instance_variable': 1})
second = Counter({'base_class_variable': 1, 'base_instance_variable': 1, 'derived_class_variable': 1, 'derived_instance_variable': 1, 'class': 1, 'dict': 1, 'doc': 1, 'module': 1, 'weakref': 1})

def check_items_equality(first, second):
    """A simplified version of the unittest.assertEqual method."""
    first_seq, second_seq = list(first), list(second)
    first = collections.Counter(first_seq)
    second = collections.Counter(second_seq)
  assert first == second

E AssertionError: assert Counter({'c...variable': 1}) == Counter({'bas...eakref': 1})
E
E Omitting 9 identical items, use -vv to show
E Left contains 2 more items:
E {'firstlineno': 1, 'static_attributes': 1}
E Use -v to get more diff

tests/test_filters.py:16: AssertionError
___________________________________ test_own ___________________________________

def test_own():
  check_items_equality(
        [p.name for p in pdir(inst).own.pattrs],
        [
            'derived_method',
            '__init__',
            'base_instance_variable',
            'derived_class_variable',
            'derived_instance_variable',
            '__doc__',
            '__module__',
        ],
    )

tests/test_filters.py:108:


first = Counter({'doc': 1, 'firstlineno': 1, 'init': 1, 'module': 1, 'static_attributes': 1, 'base_instance_variable': 1, 'derived_class_variable': 1, 'derived_instance_variable': 1, 'derived_method': 1})
second = Counter({'derived_method': 1, 'init': 1, 'base_instance_variable': 1, 'derived_class_variable': 1, 'derived_instance_variable': 1, 'doc': 1, 'module': 1})

def check_items_equality(first, second):
    """A simplified version of the unittest.assertEqual method."""
    first_seq, second_seq = list(first), list(second)
    first = collections.Counter(first_seq)
    second = collections.Counter(second_seq)
  assert first == second

E AssertionError: assert Counter({'d...d_method': 1}) == Counter({'der...module': 1})
E
E Omitting 7 identical items, use -vv to show
E Left contains 2 more items:
E {'firstlineno': 1, 'static_attributes': 1}
E Use -v to get more diff

tests/test_filters.py:16: AssertionError
__________________________________ test_slots __________________________________

fake_tty = None

def test_slots(fake_tty):
    import pdir

    class A:
        __slots__ = ['__mul__', '__hash__', 'a', 'b']

    a = A()
    result = pdir(a)

    expected = '\n'.join(
        [
            '\x1b[0;33mspecial attribute:\x1b[0m',
            (
                '    \x1b[0;36m__class__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__doc__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__module__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__slots__\x1b[0m'
            ),
            '\x1b[0;33mabstract class:\x1b[0m',
            '    \x1b[0;36m__subclasshook__\x1b[0m',
            '\x1b[0;33marithmetic:\x1b[0m',
            '    \x1b[0;36m__mul__\x1b[0m\x1b[0;35m(slotted)\x1b[0m',
            '\x1b[0;33mobject customization:\x1b[0m',
            (
                '    \x1b[0;36m__format__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__hash__\x1b[0m'
                '\x1b[0;35m(slotted)\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__init__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__new__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__repr__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__sizeof__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__str__\x1b[0m'
            ),
            '\x1b[0;33mrich comparison:\x1b[0m',
            (
                '    \x1b[0;36m__eq__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__ge__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__gt__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__le__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__lt__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__ne__\x1b[0m'
            ),
            '\x1b[0;33mattribute access:\x1b[0m',
            (
                '    \x1b[0;36m__delattr__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__dir__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__getattribute__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__setattr__\x1b[0m'
            ),
            '\x1b[0;33mclass customization:\x1b[0m',
            '    \x1b[0;36m__init_subclass__\x1b[0m',
            '\x1b[0;33mpickle:\x1b[0m',
            (
                (
                    '    \x1b[0;36m__getstate__\x1b[0m\x1b[1;30m, '
                    '\x1b[0m\x1b[0;36m__reduce__\x1b[0m\x1b[1;30m, '
                    '\x1b[0m\x1b[0;36m__reduce_ex__\x1b[0m'
                )
                if sys.version_info >= (3, 11)
                else (
                    '    \x1b[0;36m__reduce__\x1b[0m\x1b[1;30m, '
                    '\x1b[0m\x1b[0;36m__reduce_ex__\x1b[0m'
                )
            ),
            '\x1b[0;33mdescriptor:\x1b[0m',
            (
                '    \x1b[0;36ma\x1b[0m'
                '\x1b[0;35m(slotted)\x1b[0m\x1b[0;36m: '
                '\x1b[0m\x1b[1;30mclass member_descriptor with '
                'getter, setter, deleter\x1b[0m'
            ),
            (
                '    \x1b[0;36mb\x1b[0m'
                '\x1b[0;35m(slotted)\x1b[0m\x1b[0;36m: '
                '\x1b[0m\x1b[1;30mclass member_descriptor with '
                'getter, setter, deleter\x1b[0m'
            ),
        ]
    )
  assert repr(result) == expected

E AssertionError: assert '\x1b[0;33mpr...eleter\x1b[0m' == '\x1b[0;33msp...eleter\x1b[0m'
E
E + property:
E + firstlineno, static_attributes
E special attribute:
E class, doc, module, slots
E abstract class:
E subclasshook...
E
E ...Full output truncated (15 lines hidden), use '-vv' to show

tests/test_pdir_format.py:176: AssertionError
__________________________ test_search_with_argument ___________________________

fake_tty = None

def test_search_with_argument(fake_tty):
    import pdir

    class T:
        pass

    result, result2 = pdir(T).s('attr'), pdir(T).search('attr')
    result3, result4 = pdir(T).s('Attr'), pdir(T).search('Attr')
    expected = '\n'.join(
        [
            '\x1b[0;33mattribute access:\x1b[0m',
            (
                '    \x1b[0;36m__delattr__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__getattribute__\x1b[0m\x1b[1;30m, '
                '\x1b[0m\x1b[0;36m__setattr__\x1b[0m'
            ),
        ]
    )
  assert repr(result) == expected

E AssertionError: assert '\x1b[0;33mpr...attr__\x1b[0m' == '\x1b[0;33mat...attr__\x1b[0m'
E
E + property:
E + static_attributes
E attribute access:
E delattr, getattribute, setattr

tests/test_search.py:40: AssertionError
=========================== short test summary info ============================
FAILED tests/test_filters.py::test_properties - AssertionError: assert Counte...
FAILED tests/test_filters.py::test_own - AssertionError: assert Counter({'__d...
FAILED tests/test_pdir_format.py::test_slots - AssertionError: assert '\x1b[0...
FAILED tests/test_search.py::test_search_with_argument - AssertionError: asse...
=================== 4 failed, 41 passed, 1 skipped in 1.31s ====================

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions