Skip to content

Commit

Permalink
Merge pull request #9 from mbrochh/runtests2
Browse files Browse the repository at this point in the history
Added runtests.py for easier execution of tests without needing to setup
  • Loading branch information
chrisglass committed Aug 23, 2011
2 parents c21dc26 + 387dc08 commit cbd5115
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 6 deletions.
22 changes: 16 additions & 6 deletions README.rst
Expand Up @@ -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
Expand All @@ -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
39 changes: 39 additions & 0 deletions 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 cbd5115

Please sign in to comment.