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

The use of setup.py test is deprecated #116

Open
dvzrv opened this issue Jan 23, 2022 · 3 comments
Open

The use of setup.py test is deprecated #116

dvzrv opened this issue Jan 23, 2022 · 3 comments

Comments

@dvzrv
Copy link

dvzrv commented Jan 23, 2022

Hi! When packaging version 3.0.0 for Arch Linux I noticed that this project still uses the deprecated python setup.py test way of running tests.

This leads to warnings:

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.

The current way of running tests should be replaced with e.g. calls to pytest instead (this seems to require some environment setup for this project to work) to more generically also work with future versions of setuptools.

@marksweb
Copy link
Member

As far as I'm aware, pytest isn't used. So this would need an alternative. Sounds like tox is an option.

@jelly
Copy link

jelly commented Jun 1, 2024

Trying to run the tests on Python 3.12 fails due to the lack of setuptools:

py312-dj50: commands[2]> coverage run setup.py test
Traceback (most recent call last):
  File "/tmp/django-sekizai/setup.py", line 4, in <module>
    from setuptools import find_packages, setup
ModuleNotFoundError: No module named 'setuptools'
/tmp/django-sekizai/.tox/py312-dj50/lib/python3.12/site-packages/coverage/control.py:888: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")
py312-dj50: exit 1 (0.07 seconds) /tmp/django-sekizai> coverage run setup.py test pid=37276

Hacking that into requirements.txt at least makes the tests pass:

py312-dj50: install_deps> python -I -m pip install 'Django<5.1,>=5.0' -r /tmp/django-sekizai/tests/requirements/base.txt
.pkg: _optional_hooks> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_wheel> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: prepare_metadata_for_build_wheel> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py312-dj50: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/django-sekizai/.tox/.tmp/package/5/django_sekizai-4.1.0.tar.gz
py312-dj50: commands[0]> .tox/py312-dj50/bin/python --version
Python 3.12.3
py312-dj50: commands[1]> coverage erase
py312-dj50: commands[2]> coverage run 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.
/tmp/django-sekizai/.tox/py312-dj50/lib/python3.12/site-packages/setuptools/command/test.py:193: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  ir_d = dist.fetch_build_eggs(dist.install_requires)
WARNING: The wheel package is not available.
/tmp/django-sekizai/.tox/py312-dj50/lib/python3.12/site-packages/setuptools/command/test.py:194: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  tr_d = dist.fetch_build_eggs(dist.tests_require or [])
WARNING: The wheel package is not available.
/tmp/django-sekizai/.tox/py312-dj50/lib/python3.12/site-packages/setuptools/command/test.py:195: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  er_d = dist.fetch_build_eggs(
WARNING: The wheel package is not available.
running egg_info
writing django_sekizai.egg-info/PKG-INFO
writing dependency_links to django_sekizai.egg-info/dependency_links.txt
writing requirements to django_sekizai.egg-info/requires.txt
writing top-level names to django_sekizai.egg-info/top_level.txt
reading manifest file 'django_sekizai.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.py[co]' found under directory '*'
adding license file 'LICENSE'
writing manifest file 'django_sekizai.egg-info/SOURCES.txt'
running build_ext
Found 37 test(s).
System check identified no issues (0 silenced).
.....................................
----------------------------------------------------------------------
Ran 37 tests in 0.020s

OK
py312-dj50: commands[3]> coverage report
Name                                   Stmts   Miss Branch BrPart  Cover
------------------------------------------------------------------------
sekizai/__init__.py                        1      0      0      0   100%
sekizai/context.py                         6      0      0      0   100%
sekizai/context_processors.py              5      0      0      0   100%
sekizai/data.py                           19      3      2      0    86%
sekizai/helpers.py                        96      1     48      3    97%
sekizai/models.py                          0      0      0      0   100%
sekizai/templatetags/__init__.py           0      0      0      0   100%
sekizai/templatetags/sekizai_tags.py      86      0     16      0   100%
------------------------------------------------------------------------
TOTAL                                    213      4     66      3    97%
.pkg: _exit> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  py312-dj50: OK (3.52=setup[2.67]+cmd[0.00,0.06,0.70,0.08] seconds)
  congratulations :) (3.57 seconds)

@fsbraun
Copy link
Member

fsbraun commented Jun 1, 2024

@jelly Thanks for poiting this out!

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

No branches or pull requests

4 participants