Skip to content

test_ls_contrast is broken on Python 3.13 #4

Closed
@jeremyschlatter

Description

@jeremyschlatter

From the Python 3.13 release notes:

Path.glob() and rglob() now return files and directories when given a pattern that ends with “**”. Previously, only directories were returned. (Contributed by Barney Gale in gh-70303.)

test_ls_contrast enforces the previous behavior of returning only directories. Under Python 3.13, it fails as follows:

_____________________________________________________________________________________ test_ls_contrast _____________________________________________________________________________________

    def test_ls_contrast():
        """recursive list of directories in directory"""
        # setup
        d1 = to_path("d1")
        mkdir(d1)
        d1d1 = to_path("d1/d1")
        mkdir(d1d1)
        d1d2 = to_path("d1/d2")
        mkdir(d1d2)
        d1d1f1 = to_path("d1/d1/f1")
        touch(d1d1f1)
        d1d2f2 = to_path("d1/d2/f2")
        touch(d1d2f2)

        # run test
        paths = ls(d1, select="**")

        # check
>       assert set(str(f) for f in paths) == set(["d1", "d1/d1", "d1/d2"])
E       AssertionError: assert {'d1', 'd1/d1...', 'd1/d2/f2'} == {'d1', 'd1/d1', 'd1/d2'}
E
E         Extra items in the left set:
E         'd1/d2/f2'
E         'd1/d1/f1'
E         Use -v to get more diff

tests/test_ls.py:250: AssertionError

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