tags:

views:

20

answers:

1

I had been trying to add tests to a project I'm working on.

The tests are in forum/tests/

When I run manage.py test it doesn't find any of the tests I created, on the tests in Django 1.2

I started with all my tests in their own package but have simplified down to just being in my tests.py file. The current tests.py looks like:

from django.test.client import Client  
from django.test import TestCase  
from utils import *   
from forum.models import *  
from forum import auth  

class ForumTestCase(TestCase):  
    def test_root_page(self):  
        response = self.client.get('/')  
        self.assertEqual(response.status_code, 200)  

    def test_signin_page(self):  
        response = self.client.get("/account/signin/")  
        self.assertEqual(response.status_code, 200)  

I'm sure I am missing something very basic and obvious but I just can't work out what. Any ideas?

INSTALLED_APPS = (  
    'django.contrib.auth',  
    'django.contrib.contenttypes',  
    'django.contrib.sessions',  
    'django.contrib.sites',  
    'django.contrib.admin',  
    'django.contrib.humanize',  
    'forum',  
    'django_authopenid',  
)  

Why would Django testrunner not be finding the tests I created?

The tests are at forum/tests/:

__init__.py
forum/tests/test_views.py  
forum/tests/test_models.py

I also have a __init__.py file in the directory.

+1  A: 

Create file named __init__.py in

forum/tests/__init__.py

And import all test from other moduls inside it.

from test_views import SomeTestCase
from test_models import SomeOtherTestCase
rebus
Thanks, I didn't mention I already had it setup like that, EDITED above.
BryanWheelock
Seems to work for me... It works ok when you use tests.py?
rebus