From d311e6e17663161149bcc47568d0d047ceaed8e5 Mon Sep 17 00:00:00 2001 From: Damon Timm Date: Tue, 26 May 2015 17:33:25 -0700 Subject: [PATCH 1/2] Squashed commits: travis-ci + coverage commit fa7d46bb0e1c33f1d1859e8ccabb4dc9faa95497 Author: Damon Timm Date: Tue May 26 17:28:52 2015 -0700 missed this one commit d09daabd9b049f0d0947d78bbbb5835ae0c27de5 Author: Damon Timm Date: Tue May 26 17:26:37 2015 -0700 coverage to tox commit 1d691d9096074ea1255dcada0051256560daea78 Author: Damon Timm Date: Tue May 26 17:16:56 2015 -0700 readme updates commit fa95f2b07edb000ec4342d80d910bb5fcb009a8b Author: Damon Timm Date: Tue May 26 16:32:11 2015 -0700 3rd times the charm? commit fe31d051119680bc52555c1f5eab74f46da4fb69 Author: Damon Timm Date: Tue May 26 16:27:49 2015 -0700 travis updates commit 5f55494608274961d3023e6e966b07933f01ce23 Author: Damon Timm Date: Tue May 26 16:21:33 2015 -0700 travis updates commit f0eb7a18272d3b110462ae05dfeed30a707f45c4 Author: Damon Timm Date: Tue May 26 16:02:00 2015 -0700 updated ci commit a5c2dd5dae72e4659e6097029ffd084196a0ef5a Author: Damon Timm Date: Tue May 26 13:06:23 2015 -0700 adding coveralls commit 31db5d10e7d20e27176487042a400c0fdf74058d Author: Damon Timm Date: Tue May 26 12:47:53 2015 -0700 added badge commit bb6bb6bd98b00335ce338775d385c05c62384019 Author: Damon Timm Date: Tue May 26 12:43:28 2015 -0700 adding travis support commit 8173f73e4613fad513d68090b98b73d605828fd7 Author: Damon Timm Date: Tue May 26 12:38:26 2015 -0700 added tox support Am getting an InvocationError on the failing tests but they, otherwise, seem okay. not sure what the error is about or if it is causing an issue. --- .travis.yml | 19 +++++++++++++++++++ README.rst | 16 ++++++++++------ runtests.py | 15 +++++++-------- tests/requirements.txt | 2 ++ tox.ini | 18 ++++++++++++++++++ 5 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 .travis.yml create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..79181d4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: python +sudo: no +env: + - TOX_ENV=py27-django18 + - TOX_ENV=py27-django17 + - TOX_ENV=py27-django16 + - TOX_ENV=py26-django16 + - TOX_ENV=py27-django15 + - TOX_ENV=py26-django15 + - TOX_ENV=py27-django14 + - TOX_ENV=py26-django14 + - TOX_ENV=py27-djangomaster + +install: + - pip install tox coveralls Django + +script: + - tox -e $TOX_ENV +after_success: coveralls diff --git a/README.rst b/README.rst index 1cf41a6..2c767d4 100644 --- a/README.rst +++ b/README.rst @@ -1,17 +1,21 @@ Django-HitCount =============== -Basic app that allows you to track the number of hits/views for a particular -object. Detailed docs are at: +.. image:: https://travis-ci.org/thornomad/django-hitcount.svg?branch=develop + :target: https://travis-ci.org/thornomad/django-hitcount + +Basic app that allows you to track the number of hits/views for a particular object. Full documentation is available at: http://django-hitcount.rtfd.org + +Notes: +------ + +2015-05-26: Currently the management command ``hitcount_cleanup`` does not work in versions 1.7.x and 1.8.x. I've added a test suite, finally, so I can get to working on that. Hence: build-failing. - Example Project: ---------------- -I have added an example project with a simple Blog application so you can -see the hit counting demonstrated. You can use that to test the functionality and -it should work out of the box with Django 1.8.1 and Python 2.7.x. +I have added an example project with a simple Blog application so you can see the hit counting demonstrated. You can use that to test the functionality and it should work out of the box with Django 1.8.1 and Python 2.7.x. You can load some initial fixtures at:: diff --git a/runtests.py b/runtests.py index 8c2a2ee..9d9f7c1 100755 --- a/runtests.py +++ b/runtests.py @@ -8,10 +8,11 @@ DEFAULT_ARGS = [ 'tests' ] -def run_pytest_tests(args): - failures = pytest.main(args) - if failures: - sys.exit(failures) +sys.path.append(os.path.dirname(__file__)) + +def exit_on_failure(ret, message=None): + if ret: + sys.exit(ret) def run_django_tests(args): """This will only work with a later version of Django (1.8?)""" @@ -24,9 +25,7 @@ def run_django_tests(args): settings = pytest_configure() TestRunner = get_runner(settings) test_runner = TestRunner() - failures = test_runner.run_tests(args) - if failures: - sys.exit(failures) + exit_on_failure(test_runner.run_tests(args)) except ImproperlyConfigured: sys.exit('TEST #FAIL: The --django arg has only been tested with 1.8') @@ -38,7 +37,7 @@ def run_django_tests(args): sys.argv.remove('--django') except ValueError: args = DEFAULT_ARGS.append(sys.argv) - run_pytest_tests(args) + exit_on_failure(pytest.main(args)) else: args = DEFAULT_ARGS.append(sys.argv) run_django_tests(args) diff --git a/tests/requirements.txt b/tests/requirements.txt index 3e257a9..db91d5f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,2 +1,4 @@ +pytest==2.7.1 pytest-django==2.8.0 mock==1.0.1 +coverage==3.7.1 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..74ba7e3 --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +envlist = + {py26,py27}-django{14,15,16}, + {py27}-django{17,18,master}, + +[testenv] +commands = coverage run --source="hitcount" runtests.py +setenv = + PYTHONDONTWRITEBYTECODE=1 +deps = + django14: Django==1.4.20 + django15: Django==1.5.12 + django16: Django==1.6.11 + django17: Django==1.7.8 + django18: Django==1.8.2 + djangomaster: https://github.com/django/django/archive/master.tar.gz + -rtests/requirements.txt + From efbe288eedcbbf83d55fbe8ea709ab340d84be05 Mon Sep 17 00:00:00 2001 From: Damon Timm Date: Tue, 26 May 2015 17:35:04 -0700 Subject: [PATCH 2/2] updated readme --- README.rst | 12 +++++++----- hitcount/__init__.py | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 2c767d4..40f11bb 100644 --- a/README.rst +++ b/README.rst @@ -1,8 +1,10 @@ Django-HitCount =============== -.. image:: https://travis-ci.org/thornomad/django-hitcount.svg?branch=develop +.. image:: https://travis-ci.org/thornomad/django-hitcount.svg?branch=master :target: https://travis-ci.org/thornomad/django-hitcount +.. image:: https://coveralls.io/repos/thornomad/django-hitcount/badge.svg?branch=master + :target: https://coveralls.io/r/thornomad/django-hitcount?branch=master Basic app that allows you to track the number of hits/views for a particular object. Full documentation is available at: http://django-hitcount.rtfd.org @@ -19,8 +21,8 @@ I have added an example project with a simple Blog application so you can see th You can load some initial fixtures at:: - python manage.py migrate # will load some data fixtures for you - python manage.py createsuperuser # if you want admin access + python manage.py migrate # will load some data fixtures for you + python manage.py createsuperuser # if you want admin access Settings: --------- @@ -32,10 +34,10 @@ Be sure to add this to your `settings.py`:: TODO ----- -* Tests (not a single test yet!) +* More tests! (low coverage) * Internationalization (although this has been started) * Port to python 3.x -* Upload to pip repository (need to read about this) +* Upload to pip repository Contribute ---------- diff --git a/hitcount/__init__.py b/hitcount/__init__.py index 77d2626..04a6ed7 100644 --- a/hitcount/__init__.py +++ b/hitcount/__init__.py @@ -1,4 +1,4 @@ -VERSION = (1, 0, 2, 0, 1) +VERSION = (1, 0, 3, 0, 1) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1])