Permalink
Browse files

dirty tests are better than no tests

  • Loading branch information...
1 parent c0f2669 commit 817170a876ede6c0fc5b84e3cf765b50eecd87bf @jbalogh jbalogh committed Apr 4, 2010
Showing with 52 additions and 1 deletion.
  1. +1 −1 LICENSE
  2. +29 −0 runtests.sh
  3. 0 testapp/__init__.py
  4. +12 −0 testapp/settings.py
  5. +3 −0 testapp/settings_with_south.py
  6. +7 −0 testapp/test_for_nose.py
View
@@ -1,4 +1,4 @@
-Copyright (c) 2009, Jeff Balogh.
+Copyright (c) 2010, Jeff Balogh.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
View
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+export PYTHONPATH=.
+
+django_test() {
+ TEST="django-admin.py test --settings=testapp.$1"
+ $TEST 2>&1 | grep 'Ran 1 test' > /dev/null
+ if [ $? -gt 0 ]
+ then
+ echo FAIL: $2
+ $TEST
+ exit 1;
+ else
+ echo PASS: $2
+ fi
+
+ # Check that we're hijacking the help correctly.
+ $TEST --help 2>&1 | grep 'NOSE_DETAILED_ERRORS' > /dev/null
+ if [ $? -gt 0 ]
+ then
+ echo FAIL: $2 '(--help)'
+ exit 1;
+ else
+ echo PASS: $2 '(--help)'
+ fi
+}
+
+django_test 'settings' 'normal settings'
+django_test 'settings_with_south' 'with south in installed apps'
View
No changes.
View
@@ -0,0 +1,12 @@
+DATABASES = {
+ 'default': {
+ 'NAME': 'django_master',
+ 'ENGINE': 'django.db.backends.sqlite3',
+ }
+}
+
+INSTALLED_APPS = (
+ 'django_nose',
+)
+
+TEST_RUNNER = 'django_nose.run_tests'
@@ -0,0 +1,3 @@
+from settings import *
+
+INSTALLED_APPS = ('south',) + INSTALLED_APPS
View
@@ -0,0 +1,7 @@
+"""
+Django's test runner won't find this, but nose will.
+"""
+
+
+def test_addition():
+ assert 1 + 1 == 2

0 comments on commit 817170a

Please sign in to comment.