首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >django中的新测试模块python 2无法工作

django中的新测试模块python 2无法工作
EN

Stack Overflow用户
提问于 2015-01-12 07:40:10
回答 1查看 37关注 0票数 1

我在奥赖利上跟踪TDD,并试图使functional_tests独立运行,如这里所示,但我得到了错误:

代码语言:javascript
复制
ImproperlyConfigured: App with label functional_tests could not be found

目录结构如下:

├──函数测试/

init.py

│└──tests.py

├──应用程序/

│├──models.py

..。

tests.py包含以下代码:

代码语言:javascript
复制
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="admin@agiliq.com", 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")

请告诉我我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-12 08:39:49

如果您想使用python manage.py test functional_tests运行测试,如本文所示,您应该将functional_tests应用程序保留在INSTALLED_APPS中。并确保你的PYTHONPATH设置正确。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27897307

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档