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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
python -m pip install tox tox-gh-actions pytest
cclauss marked this conversation as resolved.
Show resolved Hide resolved
- name: Test with tox
run: tox
env:
Expand Down
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
16 changes: 0 additions & 16 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 @@ -134,7 +119,6 @@ def run_tests(self):
python_requires='>=3.8',
install_requires=reqs('default.txt') + reqs('runtime.txt'),
tests_require=reqs('test.txt') + reqs('test-django.txt'),
cclauss marked this conversation as resolved.
Show resolved Hide resolved
cmdclass={'test': pytest},
classifiers=classifiers,
entry_points={
'celery.beat_schedulers': [
Expand Down