Skip to content

Commit

Permalink
Update test suite to use pytest, remove related in setup.py (celery#771)
Browse files Browse the repository at this point in the history
* Fix setuptools to <v72

* Makefile: Use pytest instead of setup.py test

* Attempt to use pytest directly

* Add python -m

* Update setup.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add pytest installation to workflow

* Remove pytest from setup.py

* Unlock setuptools

* Remove tests_require

* Move pytest to tox.ini

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 29, 2024
1 parent 8fe7836 commit a50011d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ test-all: clean-pyc
$(TOX)

test:
$(PYTHON) setup.py test
$(PYTHON) -m $(PYTEST)

cov:
(cd $(TESTDIR); $(PYTEST) -x --cov="$(PROJ)" --cov-report=html)
Expand Down
17 changes: 0 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import codecs
import os
import re
import sys

import setuptools
import setuptools.command.test

NAME = 'django-celery-beat'
PACKAGE = 'django_celery_beat'
Expand Down Expand Up @@ -103,19 +101,6 @@ def reqs(*f):

# -*- %%% -*-


class pytest(setuptools.command.test.test):
user_options = [('pytest-args=', 'a', 'Arguments to pass to pytest')]

def initialize_options(self):
setuptools.command.test.test.initialize_options(self)
self.pytest_args = []

def run_tests(self):
import pytest
sys.exit(pytest.main(self.pytest_args))


setuptools.setup(
name=NAME,
packages=setuptools.find_packages(exclude=[
Expand All @@ -133,8 +118,6 @@ def run_tests(self):
license='BSD',
python_requires='>=3.8',
install_requires=reqs('default.txt') + reqs('runtime.txt'),
tests_require=reqs('test.txt') + reqs('test-django.txt'),
cmdclass={'test': pytest},
classifiers=classifiers,
entry_points={
'celery.beat_schedulers': [
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ usedevelop = true
commands =
pip install --upgrade https://github.com/celery/celery/zipball/main#egg=celery
pip install --upgrade https://github.com/celery/kombu/zipball/main#egg=kombu
pip install Django
pip install Django pytest
pytest -x --cov=django_celery_beat --cov-report=xml --no-cov-on-fail

0 comments on commit a50011d

Please sign in to comment.