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
0afc4ef0
Commit
0afc4ef0
authored
Jan 23, 2021
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' into feature/drop-fetch-build-eggs-easy-install-fallback
parents
9d61fdd3
8222d6f7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
83 additions
and
24 deletions
+83
-24
.bumpversion.cfg
.bumpversion.cfg
+1
-1
CHANGES.rst
CHANGES.rst
+18
-0
changelog.d/2459.change.rst
changelog.d/2459.change.rst
+1
-0
pyproject.toml
pyproject.toml
+3
-0
setup.cfg
setup.cfg
+3
-2
setuptools/dist.py
setuptools/dist.py
+3
-1
setuptools/tests/fixtures.py
setuptools/tests/fixtures.py
+37
-0
setuptools/tests/test_build_meta.py
setuptools/tests/test_build_meta.py
+3
-3
setuptools/tests/test_distutils_adoption.py
setuptools/tests/test_distutils_adoption.py
+3
-3
setuptools/tests/test_virtualenv.py
setuptools/tests/test_virtualenv.py
+11
-14
No files found.
.bumpversion.cfg
View file @
0afc4ef0
[bumpversion]
current_version = 51.3.
1
current_version = 51.3.
3
commit = True
tag = True
...
...
CHANGES.rst
View file @
0afc4ef0
v51
.3.3
-------
Misc
^^^^
*
#
2539
:
Fix
AttributeError
in
Description
validation
.
v51
.3.2
-------
Misc
^^^^
*
#
1390
:
Validation
of
Description
field
now
is
more
lenient
,
emitting
a
warning
and
mangling
the
value
to
be
valid
(
replacing
newlines
with
spaces
).
v51
.3.1
-------
...
...
changelog.d/2459.change.rst
0 → 100644
View file @
0afc4ef0
Tests now run in parallel via pytest-xdist, completing in about half the time. Special thanks to :user:`webknjaz` for hard work implementing test isolation. To run without parallelization, disable the plugin with ``tox -- -p no:xdist``.
pyproject.toml
View file @
0afc4ef0
...
...
@@ -24,6 +24,9 @@ addopts = "--flake8"
[pytest.enabler.cov]
addopts
=
"--cov"
[pytest.enabler.xdist]
addopts
=
"-n auto"
[tool.towncrier]
package
=
"setuptools"
package_dir
=
"setuptools"
...
...
setup.cfg
View file @
0afc4ef0
...
...
@@ -2,7 +2,7 @@
license_files =
LICENSE
name = setuptools
version = 51.3.
1
version = 51.3.
3
author = Python Packaging Authority
author_email = distutils-sig@python.org
description = Easily download, build, install, upgrade, and uninstall Python packages
...
...
@@ -47,7 +47,7 @@ testing =
pytest-black >= 0.3.7; python_implementation != "PyPy"
pytest-cov
pytest-mypy; python_implementation != "PyPy"
pytest-enabler
pytest-enabler
>= 1.0.1
# local
mock
...
...
@@ -58,6 +58,7 @@ testing =
paver
pip>=19.1 # For proper file:// URLs support.
jaraco.envs
pytest-xdist
docs =
# Keep these in sync with docs/requirements.txt
...
...
setuptools/dist.py
View file @
0afc4ef0
...
...
@@ -121,7 +121,9 @@ def read_pkg_file(self, file):
def
single_line
(
val
):
# quick and dirty validation for description pypa/setuptools#1390
if
'
\
n
'
in
val
:
raise
ValueError
(
"newlines not allowed"
)
# TODO after 2021-07-31: Replace with `raise ValueError("newlines not allowed")`
warnings
.
warn
(
"newlines not allowed and will break in the future"
)
val
=
val
.
replace
(
'
\
n
'
,
' '
)
return
val
...
...
setuptools/tests/fixtures.py
View file @
0afc4ef0
import
contextlib
import
sys
import
shutil
import
pytest
from
.
import
contexts
...
...
@@ -21,3 +25,36 @@ def user_override(monkeypatch):
def
tmpdir_cwd
(
tmpdir
):
with
tmpdir
.
as_cwd
()
as
orig
:
yield
orig
@
pytest
.
fixture
def
tmp_src
(
request
,
tmp_path
):
"""Make a copy of the source dir under `$tmp/src`.
This fixture is useful whenever it's necessary to run `setup.py`
or `pip install` against the source directory when there's no
control over the number of simultaneous invocations. Such
concurrent runs create and delete directories with the same names
under the target directory and so they influence each other's runs
when they are not being executed sequentially.
"""
tmp_src_path
=
tmp_path
/
'src'
shutil
.
copytree
(
request
.
config
.
rootdir
,
tmp_src_path
)
return
tmp_src_path
@
pytest
.
fixture
(
autouse
=
True
,
scope
=
"session"
)
def
workaround_xdist_376
(
request
):
"""
Workaround pytest-dev/pytest-xdist#376
``pytest-xdist`` tends to inject '' into ``sys.path``,
which may break certain isolation expectations.
Remove the entry so the import
machinery behaves the same irrespective of xdist.
"""
if
not
request
.
config
.
pluginmanager
.
has_plugin
(
'xdist'
):
return
with
contextlib
.
suppress
(
ValueError
):
sys
.
path
.
remove
(
''
)
setuptools/tests/test_build_meta.py
View file @
0afc4ef0
...
...
@@ -11,7 +11,7 @@ from .textwrap import DALS
class
BuildBackendBase
:
def
__init__
(
self
,
cwd
=
None
,
env
=
{},
backend_name
=
'setuptools.build_meta'
):
def
__init__
(
self
,
cwd
=
'.'
,
env
=
{},
backend_name
=
'setuptools.build_meta'
):
self
.
cwd
=
cwd
self
.
env
=
env
self
.
backend_name
=
backend_name
...
...
@@ -126,7 +126,7 @@ class TestBuildMetaBackend:
backend_name
=
'setuptools.build_meta'
def
get_build_backend
(
self
):
return
BuildBackend
(
cwd
=
'.'
,
backend_name
=
self
.
backend_name
)
return
BuildBackend
(
backend_name
=
self
.
backend_name
)
@
pytest
.
fixture
(
params
=
defns
)
def
build_backend
(
self
,
tmpdir
,
request
):
...
...
@@ -337,7 +337,7 @@ class TestBuildMetaBackend:
def
test_build_sdist_relative_path_import
(
self
,
tmpdir_cwd
):
build_files
(
self
.
_relative_path_import_files
)
build_backend
=
self
.
get_build_backend
()
with
pytest
.
raises
(
ImportError
):
with
pytest
.
raises
(
ImportError
,
match
=
"^No module named 'hello'$"
):
build_backend
.
build_sdist
(
"temp"
)
@
pytest
.
mark
.
parametrize
(
'setup_literal, requirements'
,
[
...
...
setuptools/tests/test_distutils_adoption.py
View file @
0afc4ef0
...
...
@@ -21,10 +21,10 @@ class VirtualEnv(jaraco.envs.VirtualEnv):
@
pytest
.
fixture
def
venv
(
tmp
dir
):
def
venv
(
tmp
_path
,
tmp_src
):
env
=
VirtualEnv
()
env
.
root
=
path
.
Path
(
tmp
dir
)
env
.
req
=
os
.
getcwd
(
)
env
.
root
=
path
.
Path
(
tmp
_path
/
'venv'
)
env
.
req
=
str
(
tmp_src
)
return
env
.
create
()
...
...
setuptools/tests/test_virtualenv.py
View file @
0afc4ef0
...
...
@@ -40,14 +40,11 @@ def bare_virtualenv():
yield
venv
SOURCE_DIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'../..'
)
def
test_clean_env_install
(
bare_virtualenv
):
def
test_clean_env_install
(
bare_virtualenv
,
tmp_src
):
"""
Check setuptools can be installed in a clean environment.
"""
bare_virtualenv
.
run
([
'python'
,
'setup.py'
,
'install'
],
cd
=
SOURCE_DIR
)
bare_virtualenv
.
run
([
'python'
,
'setup.py'
,
'install'
],
cd
=
tmp_src
)
def
_get_pip_versions
():
...
...
@@ -85,7 +82,7 @@ def _get_pip_versions():
@
pytest
.
mark
.
parametrize
(
'pip_version'
,
_get_pip_versions
())
def
test_pip_upgrade_from_source
(
pip_version
,
virtualenv
):
def
test_pip_upgrade_from_source
(
pip_version
,
tmp_src
,
virtualenv
):
"""
Check pip can upgrade setuptools from source.
"""
...
...
@@ -104,7 +101,7 @@ def test_pip_upgrade_from_source(pip_version, virtualenv):
virtualenv
.
run
(
' && '
.
join
((
'python setup.py -q sdist -d {dist}'
,
'python setup.py -q bdist_wheel -d {dist}'
,
)).
format
(
dist
=
dist_dir
),
cd
=
SOURCE_DIR
)
)).
format
(
dist
=
dist_dir
),
cd
=
tmp_src
)
sdist
=
glob
.
glob
(
os
.
path
.
join
(
dist_dir
,
'*.zip'
))[
0
]
wheel
=
glob
.
glob
(
os
.
path
.
join
(
dist_dir
,
'*.whl'
))[
0
]
# Then update from wheel.
...
...
@@ -113,12 +110,12 @@ def test_pip_upgrade_from_source(pip_version, virtualenv):
virtualenv
.
run
(
'pip install --no-cache-dir --upgrade '
+
sdist
)
def
_check_test_command_install_requirements
(
virtualenv
,
tmpdir
):
def
_check_test_command_install_requirements
(
virtualenv
,
tmpdir
,
cwd
):
"""
Check the test command will install all required dependencies.
"""
# Install setuptools.
virtualenv
.
run
(
'python setup.py develop'
,
cd
=
SOURCE_DIR
)
virtualenv
.
run
(
'python setup.py develop'
,
cd
=
cwd
)
def
sdist
(
distname
,
version
):
dist_path
=
tmpdir
.
join
(
'%s-%s.tar.gz'
%
(
distname
,
version
))
...
...
@@ -175,7 +172,7 @@ def _check_test_command_install_requirements(virtualenv, tmpdir):
assert
tmpdir
.
join
(
'success'
).
check
()
def
test_test_command_install_requirements
(
virtualenv
,
tmpdir
):
def
test_test_command_install_requirements
(
virtualenv
,
tmpdir
,
request
):
# Ensure pip/wheel packages are installed.
virtualenv
.
run
(
"python -c
\
"
__import__('pkg_resources').require(['pip', 'wheel'])
\
"
"
)
...
...
@@ -183,13 +180,13 @@ def test_test_command_install_requirements(virtualenv, tmpdir):
virtualenv
.
run
(
"python -m pip uninstall -y setuptools"
)
# disable index URL so bits and bobs aren't requested from PyPI
virtualenv
.
env
[
'PIP_NO_INDEX'
]
=
'1'
_check_test_command_install_requirements
(
virtualenv
,
tmpdir
)
_check_test_command_install_requirements
(
virtualenv
,
tmpdir
,
request
.
config
.
rootdir
)
def
test_no_missing_dependencies
(
bare_virtualenv
):
def
test_no_missing_dependencies
(
bare_virtualenv
,
request
):
"""
Quick and dirty test to ensure all external dependencies are vendored.
"""
for
command
in
(
'upload'
,):
# sorted(distutils.command.__all__):
bare_virtualenv
.
run
(
[
'python'
,
'setup.py'
,
command
,
'-h'
],
cd
=
SOURCE_DIR
)
cmd
=
[
'python'
,
'setup.py'
,
command
,
'-h'
]
bare_virtualenv
.
run
(
cmd
,
cd
=
request
.
config
.
rootdir
)
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