From a1dc5ac9f730e7fca7b42ab42c6446d199363eda Mon Sep 17 00:00:00 2001 From: Albert Tugushev Date: Fri, 1 Jan 2016 10:45:44 +0300 Subject: [PATCH 1/9] Use travis-ci Resolve issue #16 --- .travis.yml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4d555f6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,67 @@ +language: python +python: + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" +env: + matrix: + - DJANGO_VERSION=1.2 + - DJANGO_VERSION=1.3 + - DJANGO_VERSION=1.4 + - DJANGO_VERSION=1.5 + - DJANGO_VERSION=1.6 + - DJANGO_VERSION=1.7 + - DJANGO_VERSION=1.8 + - DJANGO_VERSION=1.9 +install: + - pip install 'coverage<4' # coverage>=4 has issues with python3 + - pip install -q Django==$DJANGO_VERSION coveralls + - python setup.py egg_info +script: coverage run --source='linaro_django_pagination' --omit *runner*,*test_project* setup.py test +after_success: + - coveralls +matrix: + include: + - python: "2.6" + env: DJANGO_VERSION=1.4 + - python: "2.6" + env: DJANGO_VERSION=1.5 + - python: "2.6" + env: DJANGO_VERSION=1.6 + exclude: + - python: "3.2" + env: DJANGO_VERSION=1.2 # Unsupported + - python: "3.2" + env: DJANGO_VERSION=1.3 # Unsupported + - python: "3.2" + env: DJANGO_VERSION=1.4 # Unsupported + - python: "3.2" + env: DJANGO_VERSION=1.9 # Unsupported + - python: "3.3" + env: DJANGO_VERSION=1.9 # ImportError: cannot import name find_spec + - python: "3.3" + env: DJANGO_VERSION=1.2 # Unsupported + - python: "3.3" + env: DJANGO_VERSION=1.3 # Unsupported + - python: "3.3" + env: DJANGO_VERSION=1.4 # Unsupported + - python: "3.4" + env: DJANGO_VERSION=1.2 # Unsupported + - python: "3.4" + env: DJANGO_VERSION=1.3 # Unsupported + - python: "3.4" + env: DJANGO_VERSION=1.4 # Unsupported + - python: "3.5" + env: DJANGO_VERSION=1.2 # Unsupported + - python: "3.5" + env: DJANGO_VERSION=1.3 # Unsupported + - python: "3.5" + env: DJANGO_VERSION=1.4 # Unsupported + - python: "3.5" + env: DJANGO_VERSION=1.5 # Unsupported + - python: "3.5" + env: DJANGO_VERSION=1.7 # AttributeError: module 'html.parser' has no attribute 'HTMLParseError' + - python: "3.5" + env: DJANGO_VERSION=1.6 # AttributeError: module 'html.parser' has no attribute 'HTMLParseError' From 3cc56edb7888c2430e41ef0f2f4e38e4357e74ab Mon Sep 17 00:00:00 2001 From: Albert Tugushev Date: Fri, 1 Jan 2016 10:52:28 +0300 Subject: [PATCH 2/9] Add *.rst extension to README file --- README => README.rst | 0 setup.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename README => README.rst (100%) diff --git a/README b/README.rst similarity index 100% rename from README rename to README.rst diff --git a/setup.py b/setup.py index 2686bd8..0fb6f20 100755 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ author='Zygmunt Krynicki', author_email='zygmunt.krynicki@linaro.org', description="linaro-django-pagination", - long_description=open("README").read(), + long_description=open("README.rst").read(), keywords='pagination,django', url='https://github.com/zyga/django-pagination', test_suite='linaro_django_pagination.test_project.tests.run_tests', From 59500533db29f189154369ce87f0027f2d0cd84c Mon Sep 17 00:00:00 2001 From: Albert Tugushev Date: Fri, 1 Jan 2016 11:44:49 +0300 Subject: [PATCH 3/9] Add travis and coveralls badges to README file --- README.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.rst b/README.rst index ff4d063..190dc82 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,14 @@ +======================== +Linaro Django Pagination +======================== + +.. image:: https://travis-ci.org/zyga/django-pagination.svg?branch=master + :target: https://travis-ci.org/zyga/django-pagination + +.. image:: https://coveralls.io/repos/zyga/django-pagination/badge.svg?branch=master&service=github + :target: https://coveralls.io/github/zyga/django-pagination?branch=master + + About the fork -------------- From 994531a1c248812008f698a7c2f6cfb7eddf2170 Mon Sep 17 00:00:00 2001 From: Albert Tugushev Date: Fri, 1 Jan 2016 11:39:44 +0300 Subject: [PATCH 4/9] Add new test runner Also move test.py file to tests directory --- linaro_django_pagination/tests/__init__.py | 0 linaro_django_pagination/tests/runner.py | 36 +++++++++++++++++++ .../{tests.py => tests/test_main.py} | 14 ++++---- setup.py | 10 ++---- 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 linaro_django_pagination/tests/__init__.py create mode 100755 linaro_django_pagination/tests/runner.py rename linaro_django_pagination/{tests.py => tests/test_main.py} (96%) diff --git a/linaro_django_pagination/tests/__init__.py b/linaro_django_pagination/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/linaro_django_pagination/tests/runner.py b/linaro_django_pagination/tests/runner.py new file mode 100755 index 0000000..44c6f69 --- /dev/null +++ b/linaro_django_pagination/tests/runner.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import django +import doctest +import sys + +from django.conf import settings + + +def runtests(): + if not settings.configured: + # Configure test environment + settings.configure( + SECRET_KEY='fake-key', + INSTALLED_APPS=( + 'linaro_django_pagination', + ), + ) + + try: + django.setup() + except AttributeError: # for Django 1.6 compatible + pass + + from django.test.utils import get_runner + + TestRunner = get_runner(settings) + test_runner = TestRunner() + failures = test_runner.run_tests( + ["linaro_django_pagination.tests"], + extra_tests=[doctest.DocTestSuite('linaro_django_pagination.tests.test_main')] + ) + sys.exit(bool(failures)) + + +if __name__ == '__main__': + runtests() diff --git a/linaro_django_pagination/tests.py b/linaro_django_pagination/tests/test_main.py similarity index 96% rename from linaro_django_pagination/tests.py rename to linaro_django_pagination/tests/test_main.py index 90468d5..ba1baa1 100644 --- a/linaro_django_pagination/tests.py +++ b/linaro_django_pagination/tests/test_main.py @@ -170,30 +170,30 @@ >>> class HttpRequest(DjangoHttpRequest): ... page = lambda self, suffix: 1 ->>> t.render(Context({'var': range(21), 'request': HttpRequest()})) +>>> t.render(Context({'var': range(21), 'request': HttpRequest()})) #doctest: +ELLIPSIS u'\\n...\\n...