Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2668145d
Commit
2668145d
authored
Dec 05, 2010
by
Hirokazu Yamamoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now can reproduce the error on AMD64 Windows Server 2008
even where os.symlink is not supported.
parent
c269ae87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+21
-16
No files found.
Lib/test/test_shutil.py
View file @
2668145d
...
@@ -271,25 +271,33 @@ class TestShutil(unittest.TestCase):
...
@@ -271,25 +271,33 @@ class TestShutil(unittest.TestCase):
shutil
.
rmtree
(
src_dir
)
shutil
.
rmtree
(
src_dir
)
shutil
.
rmtree
(
os
.
path
.
dirname
(
dst_dir
))
shutil
.
rmtree
(
os
.
path
.
dirname
(
dst_dir
))
@
unittest
.
skipUnless
(
hasattr
(
os
,
"symlink"
),
@
unittest
.
skipUnless
(
hasattr
(
os
,
'link'
),
'requires os.link'
)
"Missing symlink implementation"
)
def
test_dont_copy_file_onto_link_to_itself
(
self
):
def
test_dont_copy_file_onto_link_to_itself
(
self
):
# bug 851123.
# bug 851123.
os
.
mkdir
(
TESTFN
)
os
.
mkdir
(
TESTFN
)
src
=
os
.
path
.
join
(
TESTFN
,
'cheese'
)
src
=
os
.
path
.
join
(
TESTFN
,
'cheese'
)
dst
=
os
.
path
.
join
(
TESTFN
,
'shop'
)
dst
=
os
.
path
.
join
(
TESTFN
,
'shop'
)
try
:
try
:
f
=
open
(
src
,
'w'
)
with
open
(
src
,
'w'
)
as
f
:
f
.
write
(
'cheddar'
)
f
.
write
(
'cheddar'
)
f
.
close
()
os
.
link
(
src
,
dst
)
self
.
assertRaises
(
shutil
.
Error
,
shutil
.
copyfile
,
src
,
dst
)
if
hasattr
(
os
,
"link"
):
with
open
(
src
,
'r'
)
as
f
:
os
.
link
(
src
,
dst
)
self
.
assertEqual
(
f
.
read
(),
'cheddar'
)
self
.
assertRaises
(
shutil
.
Error
,
shutil
.
copyfile
,
src
,
dst
)
os
.
remove
(
dst
)
with
open
(
src
,
'r'
)
as
f
:
finally
:
self
.
assertEqual
(
f
.
read
(),
'cheddar'
)
shutil
.
rmtree
(
TESTFN
,
ignore_errors
=
True
)
os
.
remove
(
dst
)
@
unittest
.
skipUnless
(
hasattr
(
os
,
"symlink"
),
"Missing symlink implementation"
)
def
test_dont_copy_file_onto_symlink_to_itself
(
self
):
# bug 851123.
os
.
mkdir
(
TESTFN
)
src
=
os
.
path
.
join
(
TESTFN
,
'cheese'
)
dst
=
os
.
path
.
join
(
TESTFN
,
'shop'
)
try
:
with
open
(
src
,
'w'
)
as
f
:
f
.
write
(
'cheddar'
)
# Using `src` here would mean we end up with a symlink pointing
# Using `src` here would mean we end up with a symlink pointing
# to TESTFN/TESTFN/cheese, while it should point at
# to TESTFN/TESTFN/cheese, while it should point at
# TESTFN/cheese.
# TESTFN/cheese.
...
@@ -299,10 +307,7 @@ class TestShutil(unittest.TestCase):
...
@@ -299,10 +307,7 @@ class TestShutil(unittest.TestCase):
self
.
assertEqual
(
f
.
read
(),
'cheddar'
)
self
.
assertEqual
(
f
.
read
(),
'cheddar'
)
os
.
remove
(
dst
)
os
.
remove
(
dst
)
finally
:
finally
:
try
:
shutil
.
rmtree
(
TESTFN
,
ignore_errors
=
True
)
shutil
.
rmtree
(
TESTFN
)
except
OSError
:
pass
@
unittest
.
skipUnless
(
hasattr
(
os
,
"symlink"
),
@
unittest
.
skipUnless
(
hasattr
(
os
,
"symlink"
),
"Missing symlink implementation"
)
"Missing symlink implementation"
)
...
...
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