Permalink
Browse files

Add south support (if installed)

tests can be run with ./setup.py test
add german translations
  • Loading branch information...
1 parent d07d241 commit 482c738739e69b7cf0552ae209279df9e1e7e9ec @jedie jedie committed Oct 12, 2011
View
@@ -16,6 +16,10 @@ More Information and examples can be found here:
== history
+* v0.4.4
+** Add south support (if installed)
+** tests can be run with {{{./setup.py test}}}
+** add german translations
* v0.4.3
** Bugfix: [[https://github.com/jedie/django-dbpreferences/issues/1|For 'UserSettings' object has no attribute 'get_settings']]
* v0.4.2
@@ -7,7 +7,7 @@
import time
import warnings
-__version__ = (0, 4, 3)
+__version__ = (0, 4, 4)
VERSION_STRING = '.'.join(str(part) for part in __version__)
View
@@ -153,6 +153,13 @@ def formfield(self, **kwargs):
return super(DictField, self).formfield(**kwargs)
+try:
+ from south.modelsinspector import add_introspection_rules
+except ImportError:
+ pass
+else:
+ add_introspection_rules([], ["^dbpreferences\.fields\.DictField"])
+
if __name__ == "__main__":
import doctest
Binary file not shown.
@@ -0,0 +1,44 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR Jens Diemer <pylucid@jensdiemer.de>, 2010.
+# Jens Diemer <pylucid@jensdiemer.de>, 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PyLucid v0.9\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-09-28 14:58+0000\n"
+"PO-Revision-Date: 2011-10-12 10:51+0200\n"
+"Last-Translator: Jens Diemer <pylucid@jensdiemer.de>\n"
+"Language-Team: - <>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: de\n"
+"X-Poedit-Country: Deutschland\n"
+"X-Poedit-SourceCharset: UFT-8\n"
+"X-Poedit-Basepath: ../../../\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: admin.py:62
+msgid "Edit this preference entry"
+msgstr "Diesen DBpreferences Eintrag bearbeiten"
+
+#: admin.py:83
+msgid "You may edit it again below."
+msgstr "Das Element kann jetzt erneut bearbeitet werden."
+
+#: admin.py:102
+#, python-format
+msgid "Change %s"
+msgstr "%s ändern"
+
+#: fields.py:121
+msgid "This field cannot be null."
+msgstr "Dieses Feld darf nicht leer sein."
+
+#: models.py:90
+msgid "Site"
+msgstr "Seite"
@@ -1,12 +1,3 @@
-
-if __name__ == "__main__":
- # run unittest directly
- import os
- os.environ["DJANGO_SETTINGS_MODULE"] = "dbpreferences.tests.test_settings"
+# coding: utf-8
from dbpreferences.tests.testcases import *
-
-if __name__ == "__main__":
- # Run this unittest directly
- from django.core import management
- management.call_command('test', 'dbpreferences')
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+"""
+ run all unittests
+ ~~~~~~~~~~~~~~~~~
+
+ :copyleft: 2011 by django-dbpreferences team, see AUTHORS for more details.
+ :license: GNU GPL v3 or above, see LICENSE for more details.
+"""
+
+from __future__ import division, absolute_import
+
+import os
+
+if __name__ == "__main__":
+ # run unittest directly
+ os.environ["DJANGO_SETTINGS_MODULE"] = "test_settings"
+
+from doctest import testmod
+import sys
+import unittest
+
+import dbpreferences
+
+
+
+
+SKIP_DIRS = (".settings", ".git", "dist")
+SKIP_FILES = ("setup.py", "test.py")
+
+
+def run_all_doctests():
+ path = os.path.abspath(os.path.dirname(dbpreferences.__file__))
+ print
+ print "_" * 79
+ print "Running %r DocTests:\n" % path
+
+ total_files = 0
+ total_doctests = 0
+ total_attempted = 0
+ total_failed = 0
+ for root, dirs, filelist in os.walk(path, followlinks=True):
+ for skip_dir in SKIP_DIRS:
+ if skip_dir in dirs:
+ dirs.remove(skip_dir) # don't visit this directories
+
+ for filename in filelist:
+ if not filename.endswith(".py"):
+ continue
+ if filename in SKIP_FILES:
+ continue
+
+ total_files += 1
+
+ sys.path.insert(0, root)
+ try:
+ m = __import__(filename[:-3])
+ except ImportError, err:
+ print "***DocTest import %s error*** %s" % (filename, err)
+ except Exception, err:
+ print "***DocTest %s error*** %s" % (filename, err)
+ else:
+ failed, attempted = testmod(m)
+ total_attempted += attempted
+ total_failed += failed
+ if attempted or failed:
+ total_doctests += 1
+
+ if attempted and not failed:
+ filepath = os.path.join(root, filename)
+ print "DocTest in %s OK (failed=%i, attempted=%i)" % (
+ filepath, failed, attempted
+ )
+ finally:
+ del sys.path[0]
+ print "*** %i files readed, runs %i doctests: failed=%i, attempted=%i" % (
+ total_files, total_doctests, total_failed, total_attempted
+ )
+
+
+if __name__ == '__main__':
+ run_all_doctests()
+
+ print
+ print "_" * 79
+ print "Running Unittests:\n"
+
+ unittest.main(
+# verbosity=99
+ )
+elif "test" in sys.argv:
+ # e.g.: .../vdpreferences$ ./setup.py test
+ run_all_doctests()
@@ -9,14 +9,23 @@
from django.conf import settings
from django.test.utils import get_runner
+from django.contrib import admin
+
+from dbpreferences.models import Preference
+from dbpreferences.tests.doctest_utils import run_all_doctests
def runtests():
+ run_all_doctests()
+
+ admin.site.unregister(Preference)
+
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True)
failures = test_runner.run_tests(['dbpreferences'])
sys.exit(bool(failures))
+
if __name__ == "__main__":
# Run this unittest directly
runtests()
View
@@ -12,7 +12,7 @@
import os
import sys
-from setuptools import setup, find_packages
+from setuptools import setup, find_packages, Command
from dbpreferences import VERSION_STRING
@@ -44,6 +44,19 @@ def get_authors():
return authors
+class RunTests(Command):
+ description = "Run the django test suite"
+ user_options = []
+
+ def initialize_options(self): pass
+ def finalize_options(self): pass
+
+ def run(self):
+ os.environ["DJANGO_SETTINGS_MODULE"] = "dbpreferences.tests.test_settings"
+ import dbpreferences.tests.run_tests
+ dbpreferences.tests.run_tests.runtests()
+
+
setup(
name='django-dbpreferences',
version=VERSION_STRING,
@@ -72,5 +85,6 @@ def get_authors():
"Topic :: Internet :: WWW/HTTP :: Site Management",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Operating System :: OS Independent",
- ]
+ ],
+ cmdclass={"test": RunTests},
)

0 comments on commit 482c738

Please sign in to comment.