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
563afa97
Commit
563afa97
authored
Apr 08, 2022
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/helpers: remove python 2 compatibility code
parent
ad1b0938
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
22 deletions
+6
-22
tests/helpers.py
+6
-22
No files found.
tests/helpers.py
View file @
563afa97
...
@@ -22,7 +22,6 @@ from poetry.installation.executor import Executor
...
@@ -22,7 +22,6 @@ from poetry.installation.executor import Executor
from
poetry.packages
import
Locker
from
poetry.packages
import
Locker
from
poetry.repositories
import
Repository
from
poetry.repositories
import
Repository
from
poetry.repositories.exceptions
import
PackageNotFound
from
poetry.repositories.exceptions
import
PackageNotFound
from
poetry.utils._compat
import
WINDOWS
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
...
@@ -68,27 +67,12 @@ def fixture(path: str | None = None) -> Path:
...
@@ -68,27 +67,12 @@ def fixture(path: str | None = None) -> Path:
def
copy_or_symlink
(
source
:
Path
,
dest
:
Path
)
->
None
:
def
copy_or_symlink
(
source
:
Path
,
dest
:
Path
)
->
None
:
if
dest
.
exists
():
if
dest
.
is_symlink
()
or
dest
.
is_file
():
if
dest
.
is_symlink
():
dest
.
unlink
()
# missing_ok is only available in Python >= 3.8
os
.
unlink
(
str
(
dest
))
elif
dest
.
is_dir
():
elif
dest
.
is_dir
():
shutil
.
rmtree
(
dest
)
shutil
.
rmtree
(
str
(
dest
))
else
:
os
.
symlink
(
str
(
source
),
str
(
dest
),
target_is_directory
=
source
.
is_dir
())
os
.
unlink
(
str
(
dest
))
# Python2 does not support os.symlink on Windows whereas Python3 does.
# os.symlink requires either administrative privileges or developer mode on Win10,
# throwing an OSError if neither is active.
if
WINDOWS
:
try
:
os
.
symlink
(
str
(
source
),
str
(
dest
),
target_is_directory
=
source
.
is_dir
())
except
OSError
:
if
source
.
is_dir
():
shutil
.
copytree
(
str
(
source
),
str
(
dest
))
else
:
shutil
.
copyfile
(
str
(
source
),
str
(
dest
))
else
:
os
.
symlink
(
str
(
source
),
str
(
dest
))
class
MockDulwichRepo
:
class
MockDulwichRepo
:
...
...
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