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
a768f8d2
Commit
a768f8d2
authored
Oct 22, 2019
by
Paul Ganssle
Committed by
GitHub
Oct 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1878 from jdufresne/deprecate-test-suite
Deprecate the test command
parents
1362c8c3
cd845107
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
1 deletion
+73
-1
changelog.d/1878.change.rst
changelog.d/1878.change.rst
+1
-0
docs/setuptools.txt
docs/setuptools.txt
+13
-0
setuptools/command/test.py
setuptools/command/test.py
+9
-1
setuptools/tests/test_test.py
setuptools/tests/test_test.py
+50
-0
No files found.
changelog.d/1878.change.rst
0 → 100644
View file @
a768f8d2
Formally deprecated the ``test`` command, with the recommendation that users migrate to ``tox``.
docs/setuptools.txt
View file @
a768f8d2
...
@@ -346,6 +346,8 @@ unless you need the associated ``setuptools`` feature.
...
@@ -346,6 +346,8 @@ unless you need the associated ``setuptools`` feature.
specified test suite, e.g. via ``setup.py test``. See the section on the
specified test suite, e.g. via ``setup.py test``. See the section on the
`test`_ command below for more details.
`test`_ command below for more details.
New in 41.5.0: Deprecated the test command.
``tests_require``
``tests_require``
If your project's tests need one or more additional packages besides those
If your project's tests need one or more additional packages besides those
needed to install it, you can use this option to specify them. It should
needed to install it, you can use this option to specify them. It should
...
@@ -357,6 +359,8 @@ unless you need the associated ``setuptools`` feature.
...
@@ -357,6 +359,8 @@ unless you need the associated ``setuptools`` feature.
are run, but only downloaded to the project's setup directory if they're
are run, but only downloaded to the project's setup directory if they're
not already installed locally.
not already installed locally.
New in 41.5.0: Deprecated the test command.
.. _test_loader:
.. _test_loader:
``test_loader``
``test_loader``
...
@@ -380,6 +384,8 @@ unless you need the associated ``setuptools`` feature.
...
@@ -380,6 +384,8 @@ unless you need the associated ``setuptools`` feature.
as long as you use the ``tests_require`` option to ensure that the package
as long as you use the ``tests_require`` option to ensure that the package
containing the loader class is available when the ``test`` command is run.
containing the loader class is available when the ``test`` command is run.
New in 41.5.0: Deprecated the test command.
``eager_resources``
``eager_resources``
A list of strings naming resources that should be extracted together, if
A list of strings naming resources that should be extracted together, if
any of them is needed, or if any C extensions included in the project are
any of them is needed, or if any C extensions included in the project are
...
@@ -2142,6 +2148,11 @@ distutils configuration file the option will be added to (or removed from).
...
@@ -2142,6 +2148,11 @@ distutils configuration file the option will be added to (or removed from).
``test`` - Build package and run a unittest suite
``test`` - Build package and run a unittest suite
=================================================
=================================================
.. warning::
``test`` is deprecated and will be removed in a future version. Users
looking for a generic test entry point independent of test runner are
encouraged to use `tox <https://tox.readthedocs.io>`_.
When doing test-driven development, or running automated builds that need
When doing test-driven development, or running automated builds that need
testing before they are deployed for downloading or use, it's often useful
testing before they are deployed for downloading or use, it's often useful
to be able to run a project's unit tests without actually deploying the project
to be able to run a project's unit tests without actually deploying the project
...
@@ -2187,6 +2198,8 @@ available:
...
@@ -2187,6 +2198,8 @@ available:
If you did not set a ``test_suite`` in your ``setup()`` call, and do not
If you did not set a ``test_suite`` in your ``setup()`` call, and do not
provide a ``--test-suite`` option, an error will occur.
provide a ``--test-suite`` option, an error will occur.
New in 41.5.0: Deprecated the test command.
.. _upload:
.. _upload:
...
...
setuptools/command/test.py
View file @
a768f8d2
...
@@ -74,7 +74,7 @@ class NonDataProperty:
...
@@ -74,7 +74,7 @@ class NonDataProperty:
class
test
(
Command
):
class
test
(
Command
):
"""Command to run unit tests after in-place build"""
"""Command to run unit tests after in-place build"""
description
=
"run unit tests after in-place build"
description
=
"run unit tests after in-place build
(deprecated)
"
user_options
=
[
user_options
=
[
(
'test-module='
,
'm'
,
"Run 'test_suite' in specified module"
),
(
'test-module='
,
'm'
,
"Run 'test_suite' in specified module"
),
...
@@ -214,6 +214,14 @@ class test(Command):
...
@@ -214,6 +214,14 @@ class test(Command):
return
itertools
.
chain
(
ir_d
,
tr_d
,
er_d
)
return
itertools
.
chain
(
ir_d
,
tr_d
,
er_d
)
def
run
(
self
):
def
run
(
self
):
self
.
announce
(
"WARNING: Testing via this command is deprecated and will be "
"removed in a future version. Users looking for a generic test "
"entry point independent of test runner are encouraged to use "
"tox."
,
log
.
WARN
,
)
installed_dists
=
self
.
install_dists
(
self
.
distribution
)
installed_dists
=
self
.
install_dists
(
self
.
distribution
)
cmd
=
' '
.
join
(
self
.
_argv
)
cmd
=
' '
.
join
(
self
.
_argv
)
...
...
setuptools/tests/test_test.py
View file @
a768f8d2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
mock
from
distutils
import
log
from
distutils
import
log
import
os
import
os
...
@@ -124,3 +125,52 @@ def test_tests_are_run_once(capfd):
...
@@ -124,3 +125,52 @@ def test_tests_are_run_once(capfd):
cmd
.
run
()
cmd
.
run
()
out
,
err
=
capfd
.
readouterr
()
out
,
err
=
capfd
.
readouterr
()
assert
out
==
'Foo
\
n
'
assert
out
==
'Foo
\
n
'
@
pytest
.
mark
.
usefixtures
(
'sample_test'
)
def
test_warns_deprecation
(
capfd
):
params
=
dict
(
name
=
'foo'
,
packages
=
[
'name'
,
'name.space'
,
'name.space.tests'
],
namespace_packages
=
[
'name'
],
test_suite
=
'name.space.tests.test_suite'
,
use_2to3
=
True
)
dist
=
Distribution
(
params
)
dist
.
script_name
=
'setup.py'
cmd
=
test
(
dist
)
cmd
.
ensure_finalized
()
cmd
.
announce
=
mock
.
Mock
()
cmd
.
run
()
capfd
.
readouterr
()
msg
=
(
"WARNING: Testing via this command is deprecated and will be "
"removed in a future version. Users looking for a generic test "
"entry point independent of test runner are encouraged to use "
"tox."
)
cmd
.
announce
.
assert_any_call
(
msg
,
log
.
WARN
)
@
pytest
.
mark
.
usefixtures
(
'sample_test'
)
def
test_deprecation_stderr
(
capfd
):
params
=
dict
(
name
=
'foo'
,
packages
=
[
'name'
,
'name.space'
,
'name.space.tests'
],
namespace_packages
=
[
'name'
],
test_suite
=
'name.space.tests.test_suite'
,
use_2to3
=
True
)
dist
=
Distribution
(
params
)
dist
.
script_name
=
'setup.py'
cmd
=
test
(
dist
)
cmd
.
ensure_finalized
()
cmd
.
run
()
out
,
err
=
capfd
.
readouterr
()
msg
=
(
"WARNING: Testing via this command is deprecated and will be "
"removed in a future version. Users looking for a generic test "
"entry point independent of test runner are encouraged to use "
"tox.
\
n
"
)
assert
msg
in
err
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