Commits

Poul Sysolyatin committed 8d95216 Draft

Test project updated.

Comments (0)

Files changed (5)

 .settings
 .DS_Store
 .svn
+.env
 
 syntax: regexp
 ^test_proj/_coverage/(?!noremove)
 #!/bin/sh
+
+cd test_proj
+if [ -d ".env/bin" ]; then
+    echo "**> virtualenv exists"
+else
+    echo  "**> creating virtualenv"
+    virtualenv --no-site-packages .env
+fi
+
+source .env/bin/activate
+./bootstrup.py
+
 default_unit='admin_tools dashboard theming menu'
 default_all="$default_unit test_app"
 if [ $# -eq 0 ]
 then
-    test_proj/manage.py test $default_all
+    ./manage.py test $default_all
 else
     if [ $1 = 'unit' ]
     then
-        test_proj/manage.py test $default_unit
+        ./manage.py test $default_unit
     else
-        test_proj/manage.py test $*
+        ./manage.py test $*
     fi
 fi
+
+cd ..
+Django==1.4.2
+South==0.7.6
+
+

test_proj/bootstrup.py

+#!/usr/bin/env python
+import xmlrpclib
+import pip
+import os
+import subprocess
+
+def bootstrap():
+    required = {}
+    for req_file in ['.required',]:
+        with open(req_file) as fp:
+            for package in fp.read().splitlines():
+                if package == "":
+                    continue
+                if package.startswith("#"):
+                    continue
+                if package.startswith("-e"):
+                    version, pkg = package.split("#egg=")
+                else:
+                    pkg, version = package.split("==")
+                if pkg not in required:
+                    required[pkg] = version
+
+    for installed in pip.get_installed_distributions():
+        if (installed.project_name in required 
+            and required[installed.project_name] <= installed.version):
+            print "Skip installed '%s' (%s)" % (installed.project_name,
+                                                installed.version)
+            del required[installed.project_name]
+    for req in required:
+        subprocess.call(["pip", "install", "-U", req])
+
+if __name__ == "__main__":
+    bootstrap()

test_proj/settings.py

 # settings for django-admin-tools test project.
 import os
 PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
-MEDIA_ROOT = os.path.join(PROJECT_PATH, 'static')
-MEDIA_URL = '/static/'
-DATABASE_ENGINE = 'sqlite3'
-DATABASE_NAME = 'testdb.sqlite'
+STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
+STATIC_URL = '/static/'
+#MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
+#MEDIA_URL = '/media/'
+
+DATABASES = {
+    'default': { "ENGINE": 'django.db.backends.sqlite3'
+               , "NAME": 'testdb.sqlite'
+               , }
+    , }
 SITE_ID = 1
 DEBUG = True
 
-TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
-)
+TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
+                    'django.template.loaders.app_directories.Loader',
+    )
 
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
 )
 
-TEMPLATE_CONTEXT_PROCESSORS = (
-    'django.core.context_processors.auth',
-    'django.core.context_processors.request',
-)
+TEMPLATE_CONTEXT_PROCESSORS = ('django.contrib.auth.context_processors.auth'
+                              , 'django.core.context_processors.media'
+                              , 'django.core.context_processors.static'
+                              , 'django.core.context_processors.request'
+                              , )
 
 ROOT_URLCONF = 'urls'
 
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.admin',
+    'django.contrib.staticfiles',
 
-    'south',
+#    'south',
 
     'test_app',
 ]