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
59e116c8
Commit
59e116c8
authored
Aug 08, 2020
by
Jason R. Coombs
Committed by
GitHub
Aug 08, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2315 from pypa/feature/417-tests
Add tests capturing expected distutils behavior.
parents
5e60dc50
47ae38fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
setup.cfg
setup.cfg
+1
-0
setuptools/tests/requirements.txt
setuptools/tests/requirements.txt
+1
-0
setuptools/tests/test_distutils_adoption.py
setuptools/tests/test_distutils_adoption.py
+63
-0
No files found.
setup.cfg
View file @
59e116c8
...
...
@@ -72,6 +72,7 @@ tests =
paver; python_version>="3.6"
futures; python_version=="2.7"
pip>=19.1 # For proper file:// URLs support.
jaraco.envs
docs =
# Keep these in sync with docs/requirements.txt
...
...
setuptools/tests/requirements.txt
View file @
59e116c8
...
...
@@ -10,3 +10,4 @@ pytest-cov>=2.5.1
paver; python_version>="3.6"
futures; python_version=="2.7"
pip>=19.1 # For proper file:// URLs support.
jaraco.envs
setuptools/tests/test_distutils_adoption.py
0 → 100644
View file @
59e116c8
import
os
import
sys
import
functools
import
subprocess
import
platform
import
pytest
import
jaraco.envs
import
path
class
VirtualEnv
(
jaraco
.
envs
.
VirtualEnv
):
name
=
'.env'
def
run
(
self
,
cmd
,
*
args
,
**
kwargs
):
cmd
=
[
self
.
exe
(
cmd
[
0
])]
+
cmd
[
1
:]
return
subprocess
.
check_output
(
cmd
,
*
args
,
cwd
=
self
.
root
,
**
kwargs
)
@
pytest
.
fixture
def
venv
(
tmpdir
):
env
=
VirtualEnv
()
env
.
root
=
path
.
Path
(
tmpdir
)
env
.
req
=
os
.
getcwd
()
return
env
.
create
()
def
popen_text
(
call
):
"""
Augment the Popen call with the parameters to ensure unicode text.
"""
return
functools
.
partial
(
call
,
universal_newlines
=
True
)
\
if
sys
.
version_info
<
(
3
,
7
)
else
functools
.
partial
(
call
,
text
=
True
)
def
find_distutils
(
venv
,
imports
=
'distutils'
,
env
=
None
,
**
kwargs
):
py_cmd
=
'import {imports}; print(distutils.__file__)'
.
format
(
**
locals
())
cmd
=
[
'python'
,
'-c'
,
py_cmd
]
if
platform
.
system
()
==
'Windows'
:
env
[
'SYSTEMROOT'
]
=
os
.
environ
[
'SYSTEMROOT'
]
return
popen_text
(
venv
.
run
)(
cmd
,
env
=
env
,
**
kwargs
)
def
test_distutils_stdlib
(
venv
):
"""
Ensure stdlib distutils is used when appropriate.
"""
assert
venv
.
name
not
in
find_distutils
(
venv
,
env
=
dict
()).
split
(
os
.
sep
)
def
test_distutils_local_with_setuptools
(
venv
):
"""
Ensure local distutils is used when appropriate.
"""
env
=
dict
(
SETUPTOOLS_USE_DISTUTILS
=
'local'
)
loc
=
find_distutils
(
venv
,
imports
=
'setuptools, distutils'
,
env
=
env
)
assert
venv
.
name
in
loc
.
split
(
os
.
sep
)
@
pytest
.
mark
.
xfail
(
reason
=
"#2259"
)
def
test_distutils_local
(
venv
):
env
=
dict
(
SETUPTOOLS_USE_DISTUTILS
=
'local'
)
assert
venv
.
name
in
find_distutils
(
venv
,
env
=
env
).
split
(
os
.
sep
)
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