From 3eb17007ad17fbc8de49dd2d858d3f5925231fe2 Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 30 Nov 2020 21:33:38 +0000 Subject: [PATCH] Refactored setup.py to remove cmdclass and test packages --- analytical/tests/utils.py | 20 -------------------- setup.cfg | 2 +- setup.py | 18 ++---------------- tox.ini | 1 - 4 files changed, 3 insertions(+), 38 deletions(-) diff --git a/analytical/tests/utils.py b/analytical/tests/utils.py index 11d106d..b7fc835 100644 --- a/analytical/tests/utils.py +++ b/analytical/tests/utils.py @@ -8,26 +8,6 @@ from django.template import Template, Context, RequestContext from django.test.testcases import TestCase -def run_tests(): - """ - Use the Django test runner to run the tests. - - Sets the return code to the number of failed tests. - """ - import sys - import django - try: - django.setup() - except AttributeError: - pass - try: - from django.test.runner import DiscoverRunner as TestRunner - except ImportError: - from django.test.simple import DjangoTestSuiteRunner as TestRunner - runner = TestRunner() - sys.exit(runner.run_tests(["analytical"])) - - class TagTestCase(TestCase): """ Tests for a template tag. diff --git a/setup.cfg b/setup.cfg index d3d35ec..f3c3b37 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,4 +7,4 @@ all_files = 1 upload-dir = build/docs/html [tool:pytest] -DJANGO_SETTINGS_MODULE = analytical.tests.settings \ No newline at end of file +DJANGO_SETTINGS_MODULE = analytical.tests.settings diff --git a/setup.py b/setup.py index 0607099..9d87937 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,13 @@ import os -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +from setuptools import setup -cmdclass = {} - -try: - from sphinx.setup_command import BuildDoc - - cmdclass['build_sphinx'] = BuildDoc -except ImportError: - pass +import analytical as package def read_file(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() -import analytical as package # noqa setup( name='django-analytical', @@ -32,8 +21,6 @@ setup( packages=[ 'analytical', 'analytical.templatetags', - 'analytical.tests', - 'analytical.tests.templatetags', ], keywords=['django', 'analytics'], classifiers=[ @@ -61,5 +48,4 @@ setup( platforms=['any'], url='https://github.com/jazzband/django-analytical', download_url='https://github.com/jazzband/django-analytical/archive/master.zip', - cmdclass=cmdclass, ) diff --git a/tox.ini b/tox.ini index b60187e..d0a9f0f 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,6 @@ envlist = description = Unit tests deps = coverage - pytest pytest-django django111: Django>=1.11,<2.0 django22: Django>=2.2,<3.0