Skip to content

Path test failure with Python 3.12 #1934

@QuLogic

Description

@QuLogic

Small description
It appears that the pathlib wrapper seems to use some internals of Path, which will change in Python 312, and causes a failure of the test.

Expected result
Tests pass.

Actual result with screenshot

________________________ TestVisidataPath.test_withName ________________________
self = <visidata.tests.test_path.TestVisidataPath object at 0x3ff82351e50>
    def test_withName(self):
        'tests for visidata.Path().with_name'
    
        file_path = Path('sample_data/sample.tsv')
        url_path = Path('https://visidata.org/hello/sample.tsv')
    
>       assert 'sample_data/b.tsv' == str(file_path.with_name('b.tsv')), '{} should be sample_data/b.tsv'.format(file_path.with_name('b.tsv'))
visidata/tests/test_path.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
visidata/path.py:321: in with_name
    return Path(self._from_parsed_parts(self._drv, self._root, self._parts[:-1] + [name]))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <visidata.path.Path object at 0x3ff500d37d0>, k = '_parts'
    def __getattr__(self, k):
        if hasattr(self.__dict__, k):
            r = getattr(self.__dict__, k)
        else:
            if self.__dict__.get('_path', None) is not None:
>               r = getattr(self._path, k)
E               AttributeError: 'PosixPath' object has no attribute '_parts'. Did you mean: 'parts'?
visidata/path.py:171: AttributeError

Additional context
VisiData 2.11 and Python 3.12 b3
See full log here: https://koji.fedoraproject.org/koji/taskinfo?taskID=102609485

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions