Skip to content

Commit

Permalink
dirty tests are better than no tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jbalogh committed Apr 4, 2010
1 parent 30d49f0 commit 95224da
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
@@ -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,
Expand Down
29 changes: 29 additions & 0 deletions runtests.sh
@@ -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'
Empty file added testapp/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions testapp/settings.py
@@ -0,0 +1,12 @@
DATABASES = {
'default': {
'NAME': 'django_master',
'ENGINE': 'django.db.backends.sqlite3',
}
}

INSTALLED_APPS = (
'django_nose',
)

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
3 changes: 3 additions & 0 deletions testapp/settings_with_south.py
@@ -0,0 +1,3 @@
from settings import *

INSTALLED_APPS = ('south',) + INSTALLED_APPS
7 changes: 7 additions & 0 deletions testapp/test_for_nose.py
@@ -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 95224da

Please sign in to comment.