Skip to content

Commit

Permalink
Fixed test running
Browse files Browse the repository at this point in the history
  • Loading branch information
Chibisov Gennady committed Jul 14, 2024
1 parent 0d57f7d commit 1ad5586
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_package_data(package):
url='http://github.com/chibisov/drf-extensions',
download_url='https://pypi.python.org/pypi/drf-extensions/',
license='BSD',
install_requires=['djangorestframework>=3.10.3'],
install_requires=['djangorestframework>=3.10.3', 'packaging>=24.1'],
description='Extensions for Django REST Framework',
long_description='DRF-extensions is a collection of custom extensions for Django REST Framework',
author='Asif Saif Uddin, Gennady Chibisov',
Expand Down
2 changes: 1 addition & 1 deletion tests_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
AUTH_USER_MODEL = 'auth.User'


TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
TEST_RUNNER = 'django.test.runner.DiscoverRunner'

NOSE_ARGS = [
'--processes=%s' % multiprocessing.cpu_count(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import json


@override_settings(ROOT_URLCONF='tests_app.tests.functional.concurrency.conditional_request.urls')
@override_settings(ROOT_URLCONF='tests_app.tests.functional._concurrency.conditional_request.urls')
class BookAPITestCases(APITestCase):
"""
Run the conditional requests test cases.
`tox -- tests_app.tests.functional.concurrency.conditional_request.tests`
`tox -- tests_app.tests.functional._concurrency.conditional_request.tests`
"""
def setUp(self):
# create a book
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.test import TestCase, override_settings


@override_settings(ROOT_URLCONF='tests_app.tests.functional.examples.etags.remove_etag_gzip_postfix.urls')
@override_settings(ROOT_URLCONF='tests_app.tests.functional._examples.etags.remove_etag_gzip_postfix.urls')
class RemoveEtagGzipPostfixTest(TestCase):

@override_settings(MIDDLEWARE_CLASSES=(
Expand All @@ -16,7 +16,7 @@ def test_without_middleware(self):
self.assertEqual(response['ETag'], '"etag_value;gzip"')

@override_settings(MIDDLEWARE_CLASSES=(
'tests_app.tests.functional.examples.etags.remove_etag_gzip_postfix.middleware.RemoveEtagGzipPostfix',
'tests_app.tests.functional._examples.etags.remove_etag_gzip_postfix.middleware.RemoveEtagGzipPostfix',
'django.middleware.gzip.GZipMiddleware',
'django.middleware.common.CommonMiddleware'
))
Expand Down
9 changes: 9 additions & 0 deletions tests_app/tests/functional/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,13 @@ class Migration(migrations.Migration):
name='permissions',
field=models.ManyToManyField(to='functional.DefaultRouterPermissionModel'),
),
migrations.CreateModel(
name='Book',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, default=None, blank=True, null=True)),
('author', models.CharField(max_length=100, default=None, blank=True, null=True)),
('issn', models.CharField(max_length=100, default=None, blank=True, null=True)),
],
),
]
1 change: 1 addition & 0 deletions tests_app/tests/functional/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from .routers.models import *
from .routers.extended_default_router.models import *
from .routers.nested_router_mixin.models import *
from ._concurrency.conditional_request.models import *
1 change: 1 addition & 0 deletions tests_app/tests/unit/cache/decorators/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def setUp(self):
super().setUp()
self.request = factory.get('')
self.cache = caches[extensions_api_settings.DEFAULT_USE_CACHE]
self.cache.clear()

def test_should_return_response_if_it_is_not_in_cache(self):
class TestView(views.APIView):
Expand Down
4 changes: 2 additions & 2 deletions tests_app/tests/unit/utils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def test_adds_http_prefix(self):

def test_get_rest_framework_version_exotic_version(self):
"""See <https://github.com/chibisov/drf-extensions/pull/198>"""
with parsed_version('1.2alphaSOMETHING') as version:
self.assertEqual(version, (1, 2, 'alpha', 'SOMETHING'))
with parsed_version('1.2a2') as version:
self.assertEqual(version, (1, 2))

def test_get_rest_framework_version_normal_version(self):
"""See <https://github.com/chibisov/drf-extensions/pull/198>"""
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
envlist = py{36,37,38}-django{22}-drf{39,310,311,312}
py{36,37,38}-django{30}-drf{310,311,312}
py{36,37,38}-django{31}-drf{311,312}
py{36,37,38}-django{32}-drf{312}
envlist = py{37,38,39}-django{22}-drf{39,310,311,312}
py{37,38,39}-django{30}-drf{310,311,312}
py{37,38,39}-django{31}-drf{311,312}
py{37,38,39}-django{32}-drf{312}


[testenv]
Expand Down

0 comments on commit 1ad5586

Please sign in to comment.