Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
af57f15c
Commit
af57f15c
authored
Aug 26, 2019
by
Brian Turek
Committed by
Bryce Drennan
Aug 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pytest fixtures on Win10 (#1326)
Catch and deal with failed symlinking on Windows
parent
bd5fcf9b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
tests/conftest.py
+10
-2
tests/console/conftest.py
+10
-2
No files found.
tests/conftest.py
View file @
af57f15c
...
@@ -87,8 +87,16 @@ def mock_download(self, url, dest):
...
@@ -87,8 +87,16 @@ def mock_download(self, url, dest):
if
dest
.
exists
():
if
dest
.
exists
():
os
.
unlink
(
str
(
dest
))
os
.
unlink
(
str
(
dest
))
if
PY2
and
WINDOWS
:
# Python2 does not support os.symlink on Windows whereas Python3 does. os.symlink requires either administrative
shutil
.
copyfile
(
str
(
fixture
),
str
(
dest
))
# privileges or developer mode on Win10, throwing an OSError is neither is active.
if
WINDOWS
:
if
PY2
:
shutil
.
copyfile
(
str
(
fixture
),
str
(
dest
))
else
:
try
:
os
.
symlink
(
str
(
fixture
),
str
(
dest
))
except
OSError
:
shutil
.
copyfile
(
str
(
fixture
),
str
(
dest
))
else
:
else
:
os
.
symlink
(
str
(
fixture
),
str
(
dest
))
os
.
symlink
(
str
(
fixture
),
str
(
dest
))
...
...
tests/console/conftest.py
View file @
af57f15c
...
@@ -52,8 +52,16 @@ def mock_download(self, url, dest):
...
@@ -52,8 +52,16 @@ def mock_download(self, url, dest):
if
dest
.
exists
():
if
dest
.
exists
():
shutil
.
rmtree
(
str
(
dest
))
shutil
.
rmtree
(
str
(
dest
))
if
PY2
and
WINDOWS
:
# Python2 does not support os.symlink on Windows whereas Python3 does. os.symlink requires either administrative
shutil
.
copyfile
(
str
(
fixture
),
str
(
dest
))
# privileges or developer mode on Win10, throwing an OSError is neither is active.
if
WINDOWS
:
if
PY2
:
shutil
.
copyfile
(
str
(
fixture
),
str
(
dest
))
else
:
try
:
os
.
symlink
(
str
(
fixture
),
str
(
dest
))
except
OSError
:
shutil
.
copyfile
(
str
(
fixture
),
str
(
dest
))
else
:
else
:
os
.
symlink
(
str
(
fixture
),
str
(
dest
))
os
.
symlink
(
str
(
fixture
),
str
(
dest
))
...
...
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