1. Omer Katz
  2. django-autotree

Commits

Omer Katz  committed 82107b3

Added the app itself.
Now the setup.py scripts runs the app's tests and fail if the tests don't pass.

  • Participants
  • Parent commits cdb09e5
  • Branches default

Comments (0)

Files changed (5)

File autotree/__init__.py

View file
+__author__ = "Omer Katz"
+__copyright__ = "Copyright 2011, Omer Katz"
+__credits__ = ["Omer Katz", ]
+__license__ = "BSD"
+__version__ = "0.1"
+__maintainer__ = "Omer Katz"
+__email__ = "omer.drow@gmail.com"
+__status__ = "Pre-Alpha"

File autotree/models.py

View file
+from django.db import models
+
+# Create your models here.

File autotree/tests.py

View file
+"""
+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)

File autotree/views.py

View file
+# Create your views here.

File setup.py

View file
 import os
 from setuptools import setup
-from autotree import __author__, __version__, __email__, __status__
+import sys
+from autotree import __author__, __version__, __email__, __status__, __license__
 
 f = open(os.path.join(os.path.dirname(__file__), 'README'))
 readme = f.read()
 f.close()
 
+def run_tests():
+    from django.conf import settings
+
+    settings.configure(INSTALLED_APPS=['autotree'],
+                       DATABASES = {
+                                        'default': {
+                                            'ENGINE': 'django.db.backends.sqlite3',
+                                            'NAME': '.'
+                                        }
+                                    })
+
+    from django.test.utils import setup_test_environment
+
+    setup_test_environment()
+
+    from django.test.simple import run_tests
+
+    if run_tests(['autotree']):
+        sys.exit(1)
+
 def get_development_status(status):
     status_classifiers = {
         'Planning': 'Development Status :: 1 - Planning',
 
     return status_classifiers[status]
 
+run_tests()
+
 setup(
     name='django-autotree',
     version=__version__,
     url='http://bitbucket.org/the_drow/django-autotree',
     packages=['autotree'],
     include_package_data=True,
-    install_requires=['setuptools', 'django', 'django-sitetree'],
+    install_requires=['setuptools', 'django', 'django-sitetree>=0.3'],
     zip_safe=False,
     classifiers=[
         get_development_status(__status__),
         'Environment :: Web Environment',
         'Framework :: Django',
         'Intended Audience :: Developers',
-        'License :: OSI Approved :: BSD License',
+        'License :: OSI Approved :: %s License' % __license__,
         'Operating System :: OS Independent',
         'Programming Language :: Python',
     ],