Skip to content
Browse files

Added runtests.py for easier execution of tests without needing to se…

…tup a testproject.
  • Loading branch information...
1 parent c21dc26 commit 387dc087b64c8dfd69a2c7fc5fbd2f9468112cd8 @mbrochh mbrochh committed Aug 24, 2011
Showing with 55 additions and 6 deletions.
  1. +16 −6 README.rst
  2. +39 −0 shop_simplecategories/tests/runtests.py
View
22 README.rst
@@ -2,13 +2,14 @@
Django SHOP simple categories
==============================
-This companion application to django-SHOP provides an example of how shop deployers could implement a simple
-category system.
+This companion application to django-SHOP provides an example of how shop
+deployers could implement a simple category system.
It is perfectly usable as a simple category system.
-In basic setup, you can select products on category admin page. If you want to set categories in product admin page,
-subclass `ProductWithCategoryForm`, set `Meta` option `model` to your product model, and set this form as your product
+In basic setup, you can select products on category admin page. If you want to
+set categories in product admin page, subclass `ProductWithCategoryForm`, set
+`Meta` option `model` to your product model, and set this form as your product
form::
from shop_simplecategories.admin import ProductWithCategoryForm
@@ -28,5 +29,14 @@ outputs all root categories for you::
<ul>{% show_root_categories %}</ul>
-If you want to manipulate the output of that template tag, just override the template
-``shop_simplecategories/show_root_categories.html``
+If you want to manipulate the output of that template tag, just override the
+template ``shop_simplecategories/show_root_categories.html``
+
+Testing
+========
+
+If you want to run the testsuite make sure you have a virtual environment that
+includes django and django-shop and run::
+
+ cd shop_simplecategories/tests/
+ ./runtests.py
View
39 shop_simplecategories/tests/runtests.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+import os
+import sys
+from django.conf import settings
+
+
+DIRNAME = os.path.dirname(__file__)
+settings.configure(
+ DEBUG=True,
+ DATABASES={
+ "default": {
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": ":memory:",
+ }
+ },
+ SOUTH_TESTS_MIGRATE=False,
+ INSTALLED_APPS=(
+ 'django.contrib.contenttypes',
+ 'shop',
+ 'shop_simplecategories',
+ )
+)
+
+
+from django.test.simple import run_tests
+
+
+def runtests(*test_args):
+ if not test_args:
+ test_args = ['shop_simplecategories']
+ parent = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), "..", "..")
+ sys.path.insert(0, parent)
+ failures = run_tests(test_args, verbosity=1, interactive=True)
+ sys.exit(failures)
+
+
+if __name__ == '__main__':
+ runtests(*sys.argv[1:])

0 comments on commit 387dc08

Please sign in to comment.
Something went wrong with that request. Please try again.