Permalink
Browse files

tox test running

  • Loading branch information...
kmike committed May 10, 2012
1 parent 954333f commit caf745bc2d7056605986649054d533ea7be8bfbd
Showing with 94 additions and 23 deletions.
  1. +1 −0 .hgignore
  2. +5 −1 README.rst
  3. +2 −1 qsstats/tests.py
  4. +0 −21 runtests.py
  5. +2 −0 test_settings/__init__.py
  6. +16 −0 test_settings/mysql.py
  7. +16 −0 test_settings/postgres.py
  8. +14 −0 test_settings/sqlite.py
  9. +38 −0 tox.ini
View
@@ -12,6 +12,7 @@ syntax: glob
*.orig
*.swp
*~
+.tox
#misc files
pip-log.txt
View
@@ -218,10 +218,14 @@ time-series data which may be extremely using in plotting data:
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
==============================
View
@@ -1,7 +1,8 @@
+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):
View
@@ -1,21 +0,0 @@
-#!/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')
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
View
@@ -0,0 +1,16 @@
+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'
View
@@ -0,0 +1,16 @@
+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'
View
@@ -0,0 +1,14 @@
+INSTALLED_APPS = (
+ 'qsstats',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes'
+)
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'test'
+ }
+}
+
+SECRET_KEY = 'foo'
View
38 tox.ini
@@ -0,0 +1,38 @@
+[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

0 comments on commit caf745b

Please sign in to comment.