@@ -55,15 +55,38 @@ def init_module(filesystem):
55
55
# pylint: disable=protected-access
56
56
FakePath .filesystem = filesystem
57
57
if sys .version_info < (3 , 12 ):
58
- FakePathlibModule .PureWindowsPath ._flavour = _FakeWindowsFlavour (filesystem )
59
- FakePathlibModule .PurePosixPath ._flavour = _FakePosixFlavour (filesystem )
58
+ FakePathlibModule .WindowsPath ._flavour = _FakeWindowsFlavour (filesystem )
59
+ FakePathlibModule .PosixPath ._flavour = _FakePosixFlavour (filesystem )
60
+
61
+ # Pure POSIX path separators must be filesystem-independent.
62
+ fake_pure_posix_flavour = _FakePosixFlavour (filesystem )
63
+ fake_pure_posix_flavour .sep = "/"
64
+ fake_pure_posix_flavour .altsep = None
65
+ FakePathlibModule .PurePosixPath ._flavour = fake_pure_posix_flavour
66
+
67
+ # Pure Windows path separators must be filesystem-independent.
68
+ fake_pure_nt_flavour = _FakePosixFlavour (filesystem )
69
+ fake_pure_nt_flavour .sep = "\\ "
70
+ fake_pure_nt_flavour .altsep = "/"
71
+ FakePathlibModule .PureWindowsPath ._flavour = fake_pure_nt_flavour
60
72
else :
61
73
# in Python 3.12, the flavour is no longer an own class,
62
74
# but points to the os-specific path module (posixpath/ntpath)
63
75
fake_os = FakeOsModule (filesystem )
64
- fake_path = fake_os .path
65
- FakePathlibModule .PureWindowsPath ._flavour = fake_path
66
- FakePathlibModule .PurePosixPath ._flavour = fake_path
76
+ FakePathlibModule .PosixPath ._flavour = fake_os .path
77
+ FakePathlibModule .WindowsPath ._flavour = fake_os .path
78
+
79
+ # Pure POSIX path separators must be filesystem independent.
80
+ fake_pure_posix_os = FakeOsModule (filesystem )
81
+ fake_pure_posix_os .path .sep = "/"
82
+ fake_pure_posix_os .path .altsep = None
83
+ FakePathlibModule .PurePosixPath ._flavour = fake_pure_posix_os .path
84
+
85
+ # Pure Windows path separators must be filesystem independent.
86
+ fake_pure_nt_os = FakeOsModule (filesystem )
87
+ fake_pure_nt_os .path .sep = "\\ "
88
+ fake_pure_nt_os .path .altsep = "/"
89
+ FakePathlibModule .PureWindowsPath ._flavour = fake_pure_nt_os .path
67
90
68
91
69
92
def _wrap_strfunc (strfunc ):
0 commit comments