question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove test command and tests_require

See original GitHub issue

In this comment, @graingert proposes that we may be able to completely remove support for tests_require instead of transitioning that tooling from easy_install to pip install.

While he didn’t directly propose removal, the effort would only benefit that ticket if the install functionality were completely removed, so let’s explore what that will entail.

While I agree that tox is an excellent, powerful, robust solution, it’s more heavy than tests_require, requiring that the user have tox installed in advance. As a more thorough solution, it also is subject to bugs and constraints that a simpler test runner is not. There are several advantages to setup.py test and tests_require over tox:

  • Doesn’t have any prerequisites (except the implicit one on Setuptools, which is generally assumed).
  • As a result of not having any prerequisites, invocation is often a simple invocation (setup.py test) instead of multiple steps (e.g. pip install --user tox; python -m tox).
  • setup.py test allows for invocation under a number of different Python versions naturally (i.e. python3.3 setup.py test or py -3.3 setup.py test) whereas tox offers “run under the python in which tox is installed” or “run for explicitly-declared python versions”.
  • As setup.py test doesn’t use virtualenv, it’s not subject to virtualenv bugs or other constraints imposed by virtualenv (such as version 14 dropping support for Python 3.2.).
  • As setup.py test doesn’t rely on pip, it’s not subject to the bugs of pip (such as issues with --editable installs or namespace packages) or other constraints imposed by pip (such as dropping support for Python 3.2).

I consider these advantages small and easy enough to overcome, especially now that many of these issues have been resolved in setuptools, pip, and virtualenv. If we can get to a place that tox can broadly supplant the uses cases of setup.py test and pytest-runner (and thus tests_require) in practice, then yes, deprecating and removing it would be in order. Given the amount of activity and bugs I see around these tools, I’d asses they’re still in active use.

Before flagging this functionality as deprecated, I’d like to survey the community about the possibility to see if there are use cases that would prove difficult to support with tox.

@graingert, would you be interested in being the champion for this effort (removing tests_require), starting with the outreach on distutils-sig and then implementing the deprecation/removal changes?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:36 (24 by maintainers)

github_iconTop GitHub Comments

7reactions
mceplcommented, Jul 3, 2019

Eliminate where or how? For your own projects or for projects you are packaging? tox is similar to make test in that each project can specify its own test commands. python -munittest discover will not work for a large number of packages, which intend for you to use pytest, and presumably also intend to have the dependencies that tox installs.

Well, the problem with whole virtual environments tox promotes is that it is completely useless in the Linux packaging world: we have all builds working in their own chrooted completely isolated environments so whatever issues virtenv is trying to solve are completely irrelevant for us. Also, we have different mechanisms (full blown isolated builds in separate virtual machines or something of that calibre) for testing with different versions of Python or something.

So, we usually end up with digging into tox.ini and ripping out only unittest (or pytest, it doesn’t matter) line and using only that.

7reactions
RonnyPfannschmidtcommented, May 16, 2017

@jaraco instead of test_requires, i’d like to see something that allows pip install -e .[test]

Read more comments on GitHub >

github_iconTop Results From Across the Web

How does setuptools installs test dependencies on python ...
I understand it takes all of the modules in the tests_require list and installs them somewhere but I'm not sure where, what it...
Read more >
tcltest manual page - Tcl Bundled Packages
Use this command to create any directories that are required to exist by a test. removeDirectory name ?directory? Forces the directory referenced by...
Read more >
Testing in Java & JVM projects - Gradle User Manual
When a build fails before all tests have run, the test reports only include the results of the tests that have completed, successfully...
Read more >
Unit tests - The Meson Build system
Some tests require the use of command line arguments or environment variables. ... To disable timeout in test cases, add timeout: 0 or...
Read more >
Effective Python Testing With Pytest
The pytest command will now be available in your installation environment. Remove ads. What Makes pytest So Useful? If you've written unit ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found