Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'python setup.py test' is deprecated #328

Closed
MathieuCouette opened this issue Sep 26, 2020 · 4 comments · Fixed by #329
Closed

'python setup.py test' is deprecated #328

MathieuCouette opened this issue Sep 26, 2020 · 4 comments · Fixed by #329

Comments

@MathieuCouette
Copy link
Contributor

When I run the python setup.py test command as recommended in the CONTRIBUTING.rst file, I get the following deprecation warning:

root@964ae9d82fd6:/workspaces/yamllint# python setup.py test
running test
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.

It appears the command was deprecated last year (pypa/setuptools#1684) and might soon be completely removed (pypa/setuptools#931 (comment)). It may be safe to investigate an alternative like tox (#320).

@adrienverge
Copy link
Owner

Hello @MathieuCouette, thanks for the notice.

The problem of pull request #320 is that tox itself calls coverage run --source=yamllint setup.py test, which calls python setup.py test and triggers the deprecation warning. @ssato @MathieuCouette what would you recommend?

@MathieuCouette
Copy link
Contributor Author

Replacing python setup.py test with pytest seems to work, and looks like the easiest fix to me. This requires pytest to be installed, as well as the content of install_requires (which can be installed with pip install .).

In this situation, the move to tox addresses a different problem, which is that the test (development) dependencies currently have to be manually installed. Moving to pytest adds yet another bunch of these dependencies.

I don't think tox is necessary, but it seems nice. I don't see it as adding another test (development) dependency to be manually installed, but rather as replacing all of them (e.g., doc8, flake8, flake8-import-order, pathspec, pytest, pyyaml, sphinx). There are of course other advantages, but I think @ssato already touched on those.

I can leave my comments on the PR, if you want.

P.S.: I come from the Node.js world, and while I've used the language itself before, I am fairly new to Python development. I hadn't heard of tox before yesterday. 🙂

@ssato
Copy link
Contributor

ssato commented Sep 28, 2020

The problem of pull request #320 is that tox itself calls coverage run --source=yamllint setup.py test, which calls python setup.py test and triggers the deprecation warning. @ssato @MathieuCouette what would you recommend?

Maybe candidates are nose or nose2 or pytest and pytest is the strongest candidate, I think, because it seems that pytest is much popular than others and used in many oss projects already.

adrienverge added a commit that referenced this issue Sep 29, 2020
Using `python setup.py test` is now deprecated [1], users are encouraged
to be explicit about the test command.

Running yamllint tests using the Python standard library (`unittest`)
can be done using:

    python -m unittest discover

Why not nose, tox or pytest? Because they would add a dependency, make
tests running more complicated and verbose for new users, and their
benefit is not worth for this simple project (only 2 runtime
dependencies: PyYAML and pathspec).

Resolves #328.

[1]: pypa/setuptools#1878
@adrienverge
Copy link
Owner

Thanks for your feedback @ssato and @MathieuCouette. I have created #329 which is, I think, the easiest change to get this fixed.

adrienverge added a commit that referenced this issue Sep 29, 2020
Using `python setup.py test` is now deprecated [1], users are encouraged
to be explicit about the test command.

Running yamllint tests using the Python standard library (`unittest`)
can be done using:

    python -m unittest discover

Why not nose, tox or pytest? Because they would add a dependency, make
tests running more complicated and verbose for new users, and their
benefit is not worth for this simple project (only 2 runtime
dependencies: PyYAML and pathspec).

Resolves #328.

[1]: pypa/setuptools#1878
adrienverge added a commit that referenced this issue Sep 30, 2020
Using `python setup.py test` is now deprecated [1], users are encouraged
to be explicit about the test command.

Running yamllint tests using the Python standard library (`unittest`)
can be done using:

    python -m unittest discover

Why not nose, tox or pytest? Because they would add a dependency, make
tests running more complicated and verbose for new users, and their
benefit is not worth for this simple project (only 2 runtime
dependencies: PyYAML and pathspec).

Resolves #328.

[1]: pypa/setuptools#1878
ssato pushed a commit to ssato/yamllint that referenced this issue Oct 1, 2020
Using `python setup.py test` is now deprecated [1], users are encouraged
to be explicit about the test command.

Running yamllint tests using the Python standard library (`unittest`)
can be done using:

    python -m unittest discover

Why not nose, tox or pytest? Because they would add a dependency, make
tests running more complicated and verbose for new users, and their
benefit is not worth for this simple project (only 2 runtime
dependencies: PyYAML and pathspec).

Resolves adrienverge#328.

[1]: pypa/setuptools#1878
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants