我正在从控制台运行以下命令
$ py.test -m selenium
但后来我不断收到这个错误:
___________________________________________________ ERROR collecting setup_distribution/verify_distribution_list.py ____________________________________________________
setup_distribution/verify_distribution_list.py:1: in <module>
> from foodnet.tests.selenium.base import SeleniumFoodnetTestCase
/home/frank/.virtualenvs/foodnet27/local/lib/python2.7/site-packages/_pytest/assertion/rewrite.py:159: in load_module
> py.builtin.exec_(co, mod.__dict__)
base.py:8: in <module>
> class SeleniumFoodnetTestCase(TestCase):
E TypeError: 'module' object is not callable
以下是我正在使用的代码:
base.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
verify_distribution_list.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