I'm working on a project that uses pyfakefs to mock my filesystem to test folder creation and missing folders in a previously defined tree structure. I'm using Python 3.13 on Windows and get this output from the terminal after running my test: Terminal output: (Does anyone have a tip for formatting terminal output without getting automatic syntax highlighting?) E ====================================================================== ERROR: test_top_folders_exist (file_checker.tests.file_checker_tests.TestFolderCheck.test_top_folders_exist) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\juank\dev\projects\python\gamedev_eco\file_checker\tests\file_checker_tests.py", line 20, in test_top_folders_exist self.fs.create_dir(Path.cwd() / "gdd") ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ File "C:\Users\juank\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyfakefs\fake_filesystem.py", line 2191, in create_dir dir_path = self.absnormpath(dir_path) File "C:\Users\juank\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyfakefs\fake_filesystem.py", line 1133, in absnormpath path = self.replace_windows_root(path) File "C:\Users\juank\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyfakefs\fake_filesystem.py", line 1418, in replace_windows_root if path and self.is_windows_fs and self.root_dir: ^^^^^^^^^^^^^ File "C:\Users\juank\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyfakefs\fake_filesystem.py", line 357, in root_dir return self._mount_point_dir_for_cwd() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\juank\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyfakefs\fake_filesystem.py", line 631, in _mount_point_dir_for_cwd if path.startswith(str_root_path) and len(str_root_path) > len(mount_path): ^^^^^^^^^^^^^^^ AttributeError: 'WindowsPath' object has no attribute 'startswith' ---------------------------------------------------------------------- Ran 1 test in 0.011s FAILED (errors=1)  Test: from pyfakefs.fake_filesystem_unittest import TestCase class TestFolderCheck(TestCase): """Test top folders = gdd marketing business""" @classmethod def setUp(cls): cls.setUpClassPyfakefs() cls.fake_fs().create_dir(Path.cwd() / "gamedev_eco") cls.fake_fs().cwd = Path.cwd() / "gamedev_eco" def test_top_folders_exist(self): self.fs.create_dir(Path.cwd() / "gdd")  What is confusing for me is that the Setup class method can create a folder and change cwd to that new folder but I'm not able to create a folder inside a test. Does anyone have experience working with pyfakefs? Can anyone lend me a hand with this issue please?
The issue has been acknowledged, fixed, and the fix has been included in the 5.7.4 release of pyfakefs. No workaround should thus be necessary, any longer.