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

Update test suite to use pytest, remove related in setup.py #771

Merged
merged 11 commits into from
Jul 29, 2024
Merged
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does make test work on your machine?

Copy link
Contributor Author

@kwongtn kwongtn Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, but tox does though

Although t/unit/test_schedulers.py::test_modeladmin_PeriodicTaskAdmin::test_run_task fail 😅


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