Why doesn't Django testrunner find the tests I created?

I tried to add tests to the project I'm working on.

Tests on the forum / tests /

When I run the manage.py test, it does not find any of the tests I created on the tests in Django 1.2

I started with all my tests in my own package, but simplified to just finding myself in the tests.py file. The current test.py looks like this:

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 am sure that I am missing something very simple and obvious, but I just can’t understand that. 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 won't Django testrunner look for the tests I created?

Tests on the forum / tests /:

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

I also have a file __init__.pyin the directory.

+3
source share
1 answer

, Django 1.6 - .

Django 1.6 :

__init__.py

forum/tests/__init__.py

.

from test_views import SomeTestCase
from test_models import SomeOtherTestCase
+7

Source: https://habr.com/ru/post/1747045/


All Articles