File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 33import os
44import pathlib
55import stat
6+ import sys
67import unittest .mock as mock
78from distutils import dir_util , errors
89from distutils .dir_util import (
@@ -106,8 +107,9 @@ def test_copy_tree_exception_in_listdir(self):
106107 """
107108 An exception in listdir should raise a DistutilsFileError
108109 """
109- with mock .patch ("os.listdir" , side_effect = OSError ()), pytest .raises (
110- errors .DistutilsFileError
110+ with (
111+ mock .patch ("os.listdir" , side_effect = OSError ()),
112+ pytest .raises (errors .DistutilsFileError ),
111113 ):
112114 src = self .tempdirs [- 1 ]
113115 dir_util .copy_tree (src , None )
@@ -123,6 +125,9 @@ class FailPath(pathlib.Path):
123125 def mkdir (self , * args , ** kwargs ):
124126 raise OSError ("Failed to create directory" )
125127
128+ if sys .version_info < (3 , 12 ):
129+ _flavour = pathlib .Path ()._flavour
130+
126131 target = tmp_path / 'foodir'
127132
128133 with pytest .raises (errors .DistutilsFileError ):
You can’t perform that action at this time.
0 commit comments