Skip to content

Fake pathlib not working with Python 3.12-dev #770

Closed
@mrbean-bremen

Description

@mrbean-bremen

With the latest Python 3.12 version the CI tests for this version fail with the traceback:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\a\pyfakefs\pyfakefs\pyfakefs\tests\all_tests_without_extra_packages.py", line 30, in <module>
    from pyfakefs.tests.all_tests import AllTests  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\a\pyfakefs\pyfakefs\pyfakefs\tests\all_tests.py", line 21, in <module>
    from pyfakefs.tests import (
  File "D:\a\pyfakefs\pyfakefs\pyfakefs\tests\dynamic_patch_test.py", line 19, in <module>
    from pyfakefs import fake_filesystem_unittest
  File "D:\a\pyfakefs\pyfakefs\pyfakefs\fake_filesystem_unittest.py", line 90, in <module>
    from pyfakefs import fake_pathlib
  File "D:\a\pyfakefs\pyfakefs\pyfakefs\fake_pathlib.py", line 181, in <module>
    flavour = pathlib._Flavour  # type: ignore [attr-defined]
              ^^^^^^^^^^^^^^^^
AttributeError: module 'pathlib' has no attribute '_Flavour'

Looks like the pathlib implementation has changed again (it already did change substantially in 3.11). The fake pathlib has to be adapted accordingly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions