From 9a8fe9deea8ca47b8accc7abb84a7746c84881eb Mon Sep 17 00:00:00 2001 From: jferry Date: Mon, 17 Jun 2013 00:04:37 +0200 Subject: [PATCH] first silly unit test and tox.in file to insure cross python compatibilty --- .gitignore | 62 +++++++++++++++++++++++++++++++++--- profiler/tests.py | 16 ---------- profiler/tests/__init__.py | 4 +++ profiler/tests/settings.py | 19 +++++++++++ profiler/tests/tests.py | 9 ++++++ tox.ini | 65 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 20 deletions(-) delete mode 100644 profiler/tests.py create mode 100644 profiler/tests/__init__.py create mode 100644 profiler/tests/settings.py create mode 100644 profiler/tests/tests.py create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 107b787..5d19f16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,59 @@ -*.log -*.pot -*.pyc -local_settings.py +# python compiled source and temporary files # +############################################## + +*.py[co] *~ + +# HG, SVN # +########### + +.svn +.hg +.hgignore + +# Sqlite base # +############### + +sqlite3 + +# gettext compiled file # +######################### + +*.pot +*.mo + +# Buildout directories and files # +################################## + +*.sublime-project +*.sublime-workspace +*.egg-info +docs +local + +bin +lib +dist +eggs +parts +build +include +downloads +src_eggs +uploads +develop-eggs +cfc.egg-info + +.installed.cfg +Makefile +bootstrap.py +buildout.cfg +mydatabase.db +versions.cfg + +# Misc # +######## + +.tox +profiler_test +*.log diff --git a/profiler/tests.py b/profiler/tests.py deleted file mode 100644 index 501deb7..0000000 --- a/profiler/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/profiler/tests/__init__.py b/profiler/tests/__init__.py new file mode 100644 index 0000000..18ef0bf --- /dev/null +++ b/profiler/tests/__init__.py @@ -0,0 +1,4 @@ +# coding=utf-8 +from __future__ import unicode_literals + +from .tests import ProfilerTests # NOQA diff --git a/profiler/tests/settings.py b/profiler/tests/settings.py new file mode 100644 index 0000000..0b8ae49 --- /dev/null +++ b/profiler/tests/settings.py @@ -0,0 +1,19 @@ +# coding=utf-8 +from __future__ import absolute_import, unicode_literals +""" +django-live-profiler.tests.settings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Contains the settings to be used when running the test suite. +""" +from os.path import dirname, join + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'mydatabase' + } +} + +LOCALE_PATHS = (join(dirname(dirname(__file__)), 'locale'),) +INSTALLED_APPS = ['profiler'] +SECRET_KEY = '*' diff --git a/profiler/tests/tests.py b/profiler/tests/tests.py new file mode 100644 index 0000000..f6c0b54 --- /dev/null +++ b/profiler/tests/tests.py @@ -0,0 +1,9 @@ +from django.test import SimpleTestCase + +from ..models import SQLCompiler + + +class ProfilerTests(SimpleTestCase): + + def test_first(self): + self.assertTrue(SQLCompiler.execute_sql) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..4256e0a --- /dev/null +++ b/tox.ini @@ -0,0 +1,65 @@ +[tox] +downloadcache = {toxworkdir}/cache/ +envlist = + py26-1.4, + py26-1.5, + py27-1.4, + py27-1.5, + #pypy-1.4, + #pypy-1.5, + #py32-1.5, + py33-1.5 + +[testenv] +setenv = + PYTHONPATH = . + DJANGO_SETTINGS_MODULE = profiler.tests.settings +commands = + django-admin.py test profiler + +[testenv:py26-1.4] +basepython = python2.6 +deps = + Django==1.5.1 + +[testenv:py26-1.5] +basepython = python2.6 +deps = + Django==1.5.1 + +[testenv:py27-1.4] +basepython = python2.7 +deps = + Django==1.4.3 + +[testenv:py27-1.5] +basepython = python2.7 +deps = + Django==1.5.1 + +[testenv:pypy-1.4] +basepython = pypy +deps = + Django==1.4.3 + +# Django 1.5 not compatible with pypy 1.9... +[testenv:pypy-1.5] +basepython = pypy +deps = + Django==1.5.1 + +[testenv:py32-1.5] +basepython = python3.2 +deps = + Django==1.5.1 + +[testenv:py33-1.5] +basepython = python3.3 +deps = + Django==1.5.1 + +# Test Django trunk : 1.6 actually +[testenv:py27-trunk] +basepython = python2.7 +deps = + https://github.com/django/django/tarball/master#egg=Django