Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
01c5f817
Commit
01c5f817
authored
Aug 31, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge with 3.4; Closes #22315
parents
0f619116
01dbd70d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
dir_util.py
dir_util.py
+1
-2
tests/test_dir_util.py
tests/test_dir_util.py
+13
-0
No files found.
dir_util.py
View file @
01c5f817
...
...
@@ -125,12 +125,11 @@ def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
try
:
names
=
os
.
listdir
(
src
)
except
OSError
as
e
:
(
errno
,
errstr
)
=
e
if
dry_run
:
names
=
[]
else
:
raise
DistutilsFileError
(
"error listing files in '%s': %s"
%
(
src
,
e
rrst
r
))
"error listing files in '%s': %s"
%
(
src
,
e
.
strerro
r
))
if
not
dry_run
:
mkpath
(
dst
,
verbose
=
verbose
)
...
...
tests/test_dir_util.py
View file @
01c5f817
...
...
@@ -3,7 +3,9 @@ import unittest
import
os
import
stat
import
sys
from
unittest.mock
import
patch
from
distutils
import
dir_util
,
errors
from
distutils.dir_util
import
(
mkpath
,
remove_tree
,
create_tree
,
copy_tree
,
ensure_relative
)
...
...
@@ -11,6 +13,7 @@ from distutils import log
from
distutils.tests
import
support
from
test.support
import
run_unittest
class
DirUtilTestCase
(
support
.
TempdirManager
,
unittest
.
TestCase
):
def
_log
(
self
,
msg
,
*
args
):
...
...
@@ -119,6 +122,16 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
self
.
assertEqual
(
ensure_relative
(
'c:
\
\
home
\
\
foo'
),
'c:home
\
\
foo'
)
self
.
assertEqual
(
ensure_relative
(
'home
\
\
foo'
),
'home
\
\
foo'
)
@
patch
(
'os.listdir'
,
side_effect
=
OSError
())
def
test_copy_tree_exception_in_listdir
(
self
,
listdir
):
"""
An exception in listdir should raise a DistutilsFileError
"""
with
self
.
assertRaises
(
errors
.
DistutilsFileError
):
src
=
self
.
tempdirs
[
-
1
]
dir_util
.
copy_tree
(
src
,
None
)
def
test_suite
():
return
unittest
.
makeSuite
(
DirUtilTestCase
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment