Commits

Mikhail Korobov committed 758b1e3

tox test running

Comments (0)

Files changed (9)

 *.orig
 *.swp
 *~
+.tox
 
 #misc files
 pip-log.txt
 Testing
 =======
 
-If you'd like to test ``django-qsstats`` against your local configuration, add
+If you'd like to test ``django-qsstats-magic`` against your local configuration, add
 ``qsstats`` to your ``INSTALLED_APPS`` and run ``./manage.py test qsstats``.
 The test suite assumes that ``django.contrib.auth`` is installed.
 
+For testing against different python, DB and django versions install tox
+(pip install tox) and run 'tox' from the source checkout::
+
+    $ tox
 
 Difference from django-qsstats
 ==============================
+import datetime
+
 from django.test import TestCase
 from django.contrib.auth.models import User
 from qsstats import QuerySetStats, InvalidInterval, DateFieldMissing, QuerySetMissing
-import datetime
 
 class QuerySetStatsTestCase(TestCase):
     def test_basic_today(self):

runtests.py

-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from django.conf import settings
-from django.core.management import call_command
-import sys
-
-engine = sys.argv[1]
-
-settings.configure(
-    INSTALLED_APPS=('qsstats', 'django.contrib.auth', 'django.contrib.contenttypes'),
-    DATABASES = {
-        'default': {
-            'ENGINE': 'django.db.backends.' + engine,
-            'NAME': 'test'
-        }
-    }
-)
-
-if __name__ == "__main__":
-    call_command('test', 'qsstats')

test_settings/__init__.py

+# -*- coding: utf-8 -*-
+from __future__ import absolute_import

test_settings/mysql.py

+INSTALLED_APPS = (
+    'qsstats',
+    'django.contrib.auth',
+    'django.contrib.contenttypes'
+)
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.mysql',
+        'NAME': 'qsstats_test',
+        'USER': 'qsstats_test',
+        'PASSWORD': 'qsstats_test',
+    }
+}
+
+SECRET_KEY = 'foo'

test_settings/postgres.py

+INSTALLED_APPS = (
+    'qsstats',
+    'django.contrib.auth',
+    'django.contrib.contenttypes'
+)
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.postgresql_psycopg2',
+        'NAME': 'qsstats_test',
+        'USER': 'qsstats_test',
+        'PASSWORD': 'qsstats_test',
+    }
+}
+
+SECRET_KEY = 'foo'

test_settings/sqlite.py

+INSTALLED_APPS = (
+    'qsstats',
+    'django.contrib.auth',
+    'django.contrib.contenttypes'
+)
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': 'test'
+    }
+}
+
+SECRET_KEY = 'foo'
+[tox]
+envlist = py25,py26,py27,pypy,py_django13,py_django12,postgres,mysql
+
+[testenv]
+deps=
+    python-dateutil == 1.5
+    django == 1.4
+
+commands=
+    django-admin.py test qsstats --settings=test_settings.sqlite
+
+[testenv:py_django13]
+deps=
+    python-dateutil == 1.5
+    django == 1.3.1
+
+[testenv:py_django12]
+deps=
+    python-dateutil == 1.5
+    django == 1.2.7
+
+[testenv:postgres]
+deps=
+    python-dateutil == 1.5
+    django == 1.4
+    psycopg2
+
+commands=
+    django-admin.py test qsstats --settings=test_settings.postgres
+
+[testenv:mysql]
+deps=
+    python-dateutil == 1.5
+    django == 1.4
+    mysql-python
+
+commands=
+    django-admin.py test qsstats --settings=test_settings.postgres