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
58320f6c
Commit
58320f6c
authored
Sep 20, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.4
parents
0399b71a
aa5115c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
tests/test_dir_util.py
tests/test_dir_util.py
+3
-3
tests/test_file_util.py
tests/test_file_util.py
+7
-8
No files found.
tests/test_dir_util.py
View file @
58320f6c
...
...
@@ -122,12 +122,12 @@ 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
):
def
test_copy_tree_exception_in_listdir
(
self
):
"""
An exception in listdir should raise a DistutilsFileError
"""
with
self
.
assertRaises
(
errors
.
DistutilsFileError
):
with
patch
(
"os.listdir"
,
side_effect
=
OSError
()),
\
self
.
assertRaises
(
errors
.
DistutilsFileError
):
src
=
self
.
tempdirs
[
-
1
]
dir_util
.
copy_tree
(
src
,
None
)
...
...
tests/test_file_util.py
View file @
58320f6c
...
...
@@ -61,24 +61,23 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
wanted
=
[
'moving %s -> %s'
%
(
self
.
source
,
self
.
target_dir
)]
self
.
assertEqual
(
self
.
_logs
,
wanted
)
@
patch
(
'os.rename'
,
side_effect
=
OSError
(
'wrong'
,
1
))
def
test_move_file_exception_unpacking_rename
(
self
,
_
):
def
test_move_file_exception_unpacking_rename
(
self
):
# see issue 22182
with
self
.
assertRaises
(
DistutilsFileError
):
with
patch
(
"os.rename"
,
side_effect
=
OSError
(
"wrong"
,
1
)),
\
self
.
assertRaises
(
DistutilsFileError
):
with
open
(
self
.
source
,
'w'
)
as
fobj
:
fobj
.
write
(
'spam eggs'
)
move_file
(
self
.
source
,
self
.
target
,
verbose
=
0
)
@
patch
(
'os.rename'
,
side_effect
=
OSError
(
errno
.
EXDEV
,
'wrong'
))
@
patch
(
'os.unlink'
,
side_effect
=
OSError
(
'wrong'
,
1
))
def
test_move_file_exception_unpacking_unlink
(
self
,
rename
,
unlink
):
def
test_move_file_exception_unpacking_unlink
(
self
):
# see issue 22182
with
self
.
assertRaises
(
DistutilsFileError
):
with
patch
(
"os.rename"
,
side_effect
=
OSError
(
errno
.
EXDEV
,
"wrong"
)),
\
patch
(
"os.unlink"
,
side_effect
=
OSError
(
"wrong"
,
1
)),
\
self
.
assertRaises
(
DistutilsFileError
):
with
open
(
self
.
source
,
'w'
)
as
fobj
:
fobj
.
write
(
'spam eggs'
)
move_file
(
self
.
source
,
self
.
target
,
verbose
=
0
)
def
test_suite
():
return
unittest
.
makeSuite
(
FileUtilTestCase
)
...
...
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