From: Radek Czajka Date: Tue, 10 Nov 2026 13:26:43 +0000 (+0100) Subject: Make tests run again. Test for up to Django 6.1. Revert reading page_suffix from... X-Git-Tag: 2.2.13 X-Git-Url: https://git.mdrn.pl/django-pagination.git/commitdiff_plain/refs/tags/2.2.13 Make tests run again. Test for up to Django 6.1. Revert reading page_suffix from context, it messed up multiple paginators case. --- diff --git a/fnp_django_pagination/__init__.py b/fnp_django_pagination/__init__.py index 1b7390c..1f05a51 100644 --- a/fnp_django_pagination/__init__.py +++ b/fnp_django_pagination/__init__.py @@ -32,6 +32,3 @@ fnp-django-pagination is a set of utilities for creating robust pagination tools throughout a django application. """ - - -__version__ = (2, 2, 12, "final", 0) diff --git a/fnp_django_pagination/templatetags/pagination_tags.py b/fnp_django_pagination/templatetags/pagination_tags.py index ca51e40..d61e055 100644 --- a/fnp_django_pagination/templatetags/pagination_tags.py +++ b/fnp_django_pagination/templatetags/pagination_tags.py @@ -142,10 +142,8 @@ class AutoPaginateNode(Node): if self.multiple_paginations and 'multiple_paginations' not in context: context['multiple_paginations'] = True - if context.get('page_suffix'): - page_suffix = context['page_suffix'] - elif context.get('multiple_paginations') or getattr(context, "paginator", None): - page_suffix = '_%s' % self.queryset_var + if context.get('multiple_paginations') or getattr(context, "paginator", None): + page_suffix = '_%s' % self.queryset_var else: page_suffix = '' diff --git a/fnp_django_pagination/test_project/__init__.py b/fnp_django_pagination/test_project/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/fnp_django_pagination/test_project/example/__init__.py b/fnp_django_pagination/test_project/example/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/fnp_django_pagination/test_project/example/models.py b/fnp_django_pagination/test_project/example/models.py deleted file mode 100644 index e69de29..0000000 diff --git a/fnp_django_pagination/test_project/example/templates/example/list.html b/fnp_django_pagination/test_project/example/templates/example/list.html deleted file mode 100644 index d81a42c..0000000 --- a/fnp_django_pagination/test_project/example/templates/example/list.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "django_testproject/base.html" %} -{% load pagination_tags %} - - -{% block content %} -

This page demonstrates how autopaginate behaves under certain conditions

-

Below you can see a list of {{ item_list|length }} items.

-{% autopaginate item_list %} -{% for item in item_list %} -

Item {{item}}

-{% endfor %} -{% paginate %} -{% endblock %} diff --git a/fnp_django_pagination/test_project/example/templates/example/two_lists.html b/fnp_django_pagination/test_project/example/templates/example/two_lists.html deleted file mode 100644 index cdb44d9..0000000 --- a/fnp_django_pagination/test_project/example/templates/example/two_lists.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "django_testproject/base.html" %} -{% load pagination_tags %} - - -{% block content %} -

This page demonstrates how autopaginate behaves under certain conditions

-

Below you can see two lists.

-

First list has {{ first_item_list|length }} items.

-{% autopaginate first_item_list 5 %} -{% for item in first_item_list %} -

{{item}}

-{% endfor %} -{% paginate using "pagination/custom_pagination.html" %} - -

Second list has {{ second_item_list|length}} items.

-{% autopaginate second_item_list 5 %} -{% paginate %} -{% for item in second_item_list %} -

{{item}}

-{% endfor %} -{% endblock %} diff --git a/fnp_django_pagination/test_project/example/templates/pagination/custom_pagination.html b/fnp_django_pagination/test_project/example/templates/pagination/custom_pagination.html deleted file mode 100644 index 49320b9..0000000 --- a/fnp_django_pagination/test_project/example/templates/pagination/custom_pagination.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "pagination/pagination.html" %} - - -{% block previouslink %} -

This part is custom

- {{ block.super }} -{% endblock previouslink %} diff --git a/fnp_django_pagination/test_project/example/urls.py b/fnp_django_pagination/test_project/example/urls.py deleted file mode 100644 index f3fc5ae..0000000 --- a/fnp_django_pagination/test_project/example/urls.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2010, 2011 Linaro Limited -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the author nor the names of other -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -from django.conf.urls.defaults import ( - patterns, url, include, handler500, handler404) - -urlpatterns = patterns( - 'example.views', - url(r'^list/$', 'list'), - url(r'^complex-list/$', 'complex_list')) diff --git a/fnp_django_pagination/test_project/example/views.py b/fnp_django_pagination/test_project/example/views.py deleted file mode 100644 index a2284d0..0000000 --- a/fnp_django_pagination/test_project/example/views.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2010, 2011 Linaro Limited -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the author nor the names of other -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -from django.shortcuts import render_to_response -from django.template import RequestContext - - -def list(request): - return render_to_response("example/list.html", { - 'item_list': range(1000), - }, RequestContext(request)) - - -def complex_list(request): - return render_to_response("example/two_lists.html", { - 'first_item_list': ["first list item %d" % item for item in range(1000)], - 'second_item_list': ["second list item %d" % item for item in range(1000)], - }, RequestContext(request)) diff --git a/fnp_django_pagination/test_project/manage.py b/fnp_django_pagination/test_project/manage.py deleted file mode 100755 index bfb13d7..0000000 --- a/fnp_django_pagination/test_project/manage.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2010, 2011 Linaro Limited -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the author nor the names of other -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import logging - -from django.core.management import execute_manager - -try: - from fnp_django_pagination.test_project import settings -except ImportError as ex: - logging.exception("Unable to import application settings") - raise SystemExit(ex) - - -if __name__ == "__main__": - execute_manager(settings) diff --git a/fnp_django_pagination/test_project/settings.py b/fnp_django_pagination/test_project/settings.py deleted file mode 100644 index 7791775..0000000 --- a/fnp_django_pagination/test_project/settings.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2010, 2011 Linaro Limited -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the author nor the names of other -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import sys -import os - -# Add this directory to path so that 'example' can be imported later -# below. Without this the runner will fail when started via ``setup.py -# test`` -sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) - -from django_testproject.settings import gen_settings - - -locals().update( - gen_settings( - INSTALLED_APPS=[ - 'example', - 'fnp_django_pagination'], - MIDDLEWARE_CLASSES=[ - 'fnp_django_pagination.middleware.PaginationMiddleware'], - TEMPLATE_CONTEXT_PROCESSORS=[ - # Request processor needs to be enabled - 'django.core.context_processors.request'], - ROOT_URLCONF="fnp_django_pagination.test_project.urls"), - TEMPLATE_LOADERS = ['django.template.loaders.app_directories.Loader'], - SECRET_KEY = 'not for production', - ) diff --git a/fnp_django_pagination/test_project/tests.py b/fnp_django_pagination/test_project/tests.py deleted file mode 100644 index 02ba73b..0000000 --- a/fnp_django_pagination/test_project/tests.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2010, 2011 Linaro Limited -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the author nor the names of other -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -def run_tests(): - from django_testproject.tests import run_tests_for - run_tests_for("fnp_django_pagination.test_project.settings") - - -if __name__ == '__main__': - run_tests() diff --git a/fnp_django_pagination/test_project/urls.py b/fnp_django_pagination/test_project/urls.py deleted file mode 100644 index cfdf466..0000000 --- a/fnp_django_pagination/test_project/urls.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2010, 2011 Linaro Limited -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of the author nor the names of other -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -from django.conf.urls.defaults import ( - patterns, url, include, handler500, handler404) - -# Empty patterns so that test project can be started and would work normally -urlpatterns = patterns('', url('', include('example.urls'))) diff --git a/fnp_django_pagination/tests/runner.py b/fnp_django_pagination/tests/runner.py deleted file mode 100755 index 4604e6b..0000000 --- a/fnp_django_pagination/tests/runner.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python - -import django -import os -import sys - -from django.core.management import call_command - - -def runtests(): - os.environ['DJANGO_SETTINGS_MODULE'] = 'fnp_django_pagination.tests.settings' - django.setup() - - failures = call_command('test', 'fnp_django_pagination') - sys.exit(bool(failures)) - -if __name__ == '__main__': - runtests() diff --git a/fnp_django_pagination/tests/settings.py b/fnp_django_pagination/tests/settings.py deleted file mode 100644 index d320df8..0000000 --- a/fnp_django_pagination/tests/settings.py +++ /dev/null @@ -1,19 +0,0 @@ -DATABASES = { - 'default': { - 'NAME': ':memory:', - 'ENGINE': 'django.db.backends.sqlite3', - } -} - -SECRET_KEY = 'fake-key' - -INSTALLED_APPS = ( - 'fnp_django_pagination', -) - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'APP_DIRS': True, - }, -] diff --git a/runtests.py b/runtests.py new file mode 100755 index 0000000..4ab5eda --- /dev/null +++ b/runtests.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import django +import os +import sys + +from django.core.management import call_command + + +def runtests(): + os.environ['DJANGO_SETTINGS_MODULE'] = 'test_project.settings' + django.setup() + + failures = call_command('test', 'fnp_django_pagination') + sys.exit(bool(failures)) + +if __name__ == '__main__': + runtests() diff --git a/setup.py b/setup.py index 49d9d4a..29506fd 100755 --- a/setup.py +++ b/setup.py @@ -36,17 +36,15 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'fnp_django_pagination.tests.settings' setup( name='fnp-django-pagination', - # Magic version handling with versiontools - version=":versiontools:fnp_django_pagination:__version__", + version="2.2.13", author='Zygmunt Krynicki', author_email='zygmunt.krynicki@linaro.org', description="fnp-django-pagination", long_description=open("README.rst").read(), keywords='pagination,django', url='https://github.com/fnp/django-pagination', - test_suite="fnp_django_pagination.tests.runner.runtests", license='BSD', - packages=find_packages(), + packages=find_packages(exclude=['tests*']), classifiers=[ "Development Status :: 4 - Beta", "Environment :: Web Environment", @@ -59,8 +57,5 @@ setup( "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", ], - setup_requires=[ - 'versiontools >= 1.3.1' - ], include_package_data=True, ) diff --git a/test_project/__init__.py b/test_project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_project/example/__init__.py b/test_project/example/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_project/example/models.py b/test_project/example/models.py new file mode 100644 index 0000000..e69de29 diff --git a/test_project/example/templates/example/list.html b/test_project/example/templates/example/list.html new file mode 100644 index 0000000..d81a42c --- /dev/null +++ b/test_project/example/templates/example/list.html @@ -0,0 +1,13 @@ +{% extends "django_testproject/base.html" %} +{% load pagination_tags %} + + +{% block content %} +

This page demonstrates how autopaginate behaves under certain conditions

+

Below you can see a list of {{ item_list|length }} items.

+{% autopaginate item_list %} +{% for item in item_list %} +

Item {{item}}

+{% endfor %} +{% paginate %} +{% endblock %} diff --git a/test_project/example/templates/example/two_lists.html b/test_project/example/templates/example/two_lists.html new file mode 100644 index 0000000..cdb44d9 --- /dev/null +++ b/test_project/example/templates/example/two_lists.html @@ -0,0 +1,21 @@ +{% extends "django_testproject/base.html" %} +{% load pagination_tags %} + + +{% block content %} +

This page demonstrates how autopaginate behaves under certain conditions

+

Below you can see two lists.

+

First list has {{ first_item_list|length }} items.

+{% autopaginate first_item_list 5 %} +{% for item in first_item_list %} +

{{item}}

+{% endfor %} +{% paginate using "pagination/custom_pagination.html" %} + +

Second list has {{ second_item_list|length}} items.

+{% autopaginate second_item_list 5 %} +{% paginate %} +{% for item in second_item_list %} +

{{item}}

+{% endfor %} +{% endblock %} diff --git a/test_project/example/templates/pagination/custom_pagination.html b/test_project/example/templates/pagination/custom_pagination.html new file mode 100644 index 0000000..49320b9 --- /dev/null +++ b/test_project/example/templates/pagination/custom_pagination.html @@ -0,0 +1,7 @@ +{% extends "pagination/pagination.html" %} + + +{% block previouslink %} +

This part is custom

+ {{ block.super }} +{% endblock previouslink %} diff --git a/test_project/example/urls.py b/test_project/example/urls.py new file mode 100644 index 0000000..f3fc5ae --- /dev/null +++ b/test_project/example/urls.py @@ -0,0 +1,37 @@ +# Copyright (c) 2010, 2011 Linaro Limited +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +from django.conf.urls.defaults import ( + patterns, url, include, handler500, handler404) + +urlpatterns = patterns( + 'example.views', + url(r'^list/$', 'list'), + url(r'^complex-list/$', 'complex_list')) diff --git a/test_project/example/views.py b/test_project/example/views.py new file mode 100644 index 0000000..a2284d0 --- /dev/null +++ b/test_project/example/views.py @@ -0,0 +1,45 @@ +# Copyright (c) 2010, 2011 Linaro Limited +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +from django.shortcuts import render_to_response +from django.template import RequestContext + + +def list(request): + return render_to_response("example/list.html", { + 'item_list': range(1000), + }, RequestContext(request)) + + +def complex_list(request): + return render_to_response("example/two_lists.html", { + 'first_item_list': ["first list item %d" % item for item in range(1000)], + 'second_item_list': ["second list item %d" % item for item in range(1000)], + }, RequestContext(request)) diff --git a/test_project/manage.py b/test_project/manage.py new file mode 100755 index 0000000..bfb13d7 --- /dev/null +++ b/test_project/manage.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# Copyright (c) 2010, 2011 Linaro Limited +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import logging + +from django.core.management import execute_manager + +try: + from fnp_django_pagination.test_project import settings +except ImportError as ex: + logging.exception("Unable to import application settings") + raise SystemExit(ex) + + +if __name__ == "__main__": + execute_manager(settings) diff --git a/test_project/settings.py b/test_project/settings.py new file mode 100644 index 0000000..d320df8 --- /dev/null +++ b/test_project/settings.py @@ -0,0 +1,19 @@ +DATABASES = { + 'default': { + 'NAME': ':memory:', + 'ENGINE': 'django.db.backends.sqlite3', + } +} + +SECRET_KEY = 'fake-key' + +INSTALLED_APPS = ( + 'fnp_django_pagination', +) + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + }, +] diff --git a/test_project/tests.py b/test_project/tests.py new file mode 100644 index 0000000..02ba73b --- /dev/null +++ b/test_project/tests.py @@ -0,0 +1,37 @@ +# Copyright (c) 2010, 2011 Linaro Limited +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +def run_tests(): + from django_testproject.tests import run_tests_for + run_tests_for("fnp_django_pagination.test_project.settings") + + +if __name__ == '__main__': + run_tests() diff --git a/test_project/urls.py b/test_project/urls.py new file mode 100644 index 0000000..cfdf466 --- /dev/null +++ b/test_project/urls.py @@ -0,0 +1,35 @@ +# Copyright (c) 2010, 2011 Linaro Limited +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +from django.conf.urls.defaults import ( + patterns, url, include, handler500, handler404) + +# Empty patterns so that test project can be started and would work normally +urlpatterns = patterns('', url('', include('example.urls'))) diff --git a/tox.ini b/tox.ini index 23ee964..5566ce6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,20 @@ [tox] envlist=clear, - d{21}-py{36,37} - d{22,30,31}-py{36,37,38,39} - d32-py{36,37,38,39,310} - d40-py{38,39,310} - d41-py{38,39,310,311} - d42-py{38,39,310,311} + d{22,30,31}-py{38,39}, + d{32,40}-py{38,39,310}, + d41-py{38,39,310,311}, + d42-py{38,39,310,311,312}, + d50-py{310,311,312}, + d51-py{310,311,312,313}, + d52-py{310,311,312,313,314}, + d60-py{312,313,314}, + d61-py{312,313,314,315}, stats [testenv] -commands=coverage run --source=fnp_django_pagination --omit *runner*,*test_project* setup.py test +commands=coverage run --source=fnp_django_pagination runtests.py deps= - d20: Django>=2.0,<2.1 - d21: Django>=2.1,<2.2 + setuptools d22: Django>=2.2,<3.0 d30: Django>=3.0,<3.1 d31: Django>=3.1,<3.2 @@ -20,6 +22,11 @@ deps= d40: Django>=4.0,<4.1 d41: Django~=4.1.0 d42: Django~=4.2.0 + d50: Django~=5.0.0 + d51: Django~=5.1.0 + d52: Django~=5.2.0 + d60: Django~=6.0.0 + d61: Django~=6.1.0 coverage [testenv:clear]