yogkm
yogkm

Reputation: 649

New test module in django with python 2 not working

I was following the TDD at O'Reilly and I tried to make the functional_tests to run in isolation as shown here But I'm getting the error:

ImproperlyConfigured: App with label functional_tests could not be found

Directory structure is as below:

├── functional_tests/

│ ├── init.py

│ └── tests.py

├── apps/

│ ├── models.py

...

tests.py contains following code:

from django.test.client import Client
from django.contrib.auth.models import User
from django.test import LiveServerTestCase

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


class FunctionalTest(LiveServerTestCase):

    def setUp(self):
        self.browser = webdriver.Firefox()
        self.browser.implicitly_wait(3)
        self.c = Client()
        self.user = User.objects.create_user(
            username="admin", email="[email protected]", password="admin")

    def tearDown(self):
        self.browser.quit()

    def test_admin_login(self):
        self.browser.get(self.live_server_url)
        # login = self.browser.find_element_by_link_text("Login")

Please tell me what am I doing wrong?

Upvotes: 1

Views: 41

Answers (1)

irqed
irqed

Reputation: 649

If you want to run your tests with python manage.py test functional_tests as it shown in the article you should keep functional_tests app in the INSTALLED_APPS. And make sure your PYTHONPATH is set up properly.

Upvotes: 1

Related Questions