运行测试时出现“TypeError:'module'object is not callable”(无法调用“模块”对象)

2024-10-01 22:36:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在控制台上运行以下命令

$ py.test -m selenium

但后来我一直得到这个错误:

^{pr2}$

下面是我使用的代码:

在基准.py在

from unittest import TestCase
from foodnet.tests import selenium
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, NoAlertPresentException


@selenium
class SeleniumFoodnetTestCase(TestCase):

    superuser_username = 'admin'
    superuser_password = 'some_pwd'
    server_base_url = "http://localhost:8000"

    def setUp(self): # The rest of the code hidden

验证分配_列表.py在

from foodnet.tests.selenium.base import SeleniumFoodnetTestCase


class CreateDistributionList(SeleniumFoodnetTestCase):

    def test_create_distribution_list(self):
        driver = self.driver
        # The rest of the code hidden for brevity

你知道我为什么会犯上述错误吗?在

更新:下面是我的目录结构

foodnet
|
|- tests
      |
      |- selenium
            |
            |- base.py
            |
            |- setup_distribution
                    |
                    |- verify_distribution_list.py

Tags: frompytestimportselfbaseselenium错误

热门问题