我用的是吡喃和硒。当我尝试运行测试脚本时:
import pytest
from selenium import webdriver
from pages import *
from locators import *
from selenium.webdriver.common.by import By
import time
class RegisterNewInstructor:
def setup_class(cls):
cls.driver = webdriver.Firefox()
cls.driver.get("http://my
我正在尝试将py.test的与我的单元测试结合在一起,与unittest一起使用。我在项目的顶层(如描述的)将几个夹具放在conftest.py文件中,用@pytest.fixture装饰它们,并将它们的名称作为需要它们的测试函数的参数。
安装程序注册正确,如py.test --fixtures test_stuff.py所示,但是当我运行py.test时,我得到了NameError: global name 'my_fixture' is not defined。这似乎只有在我使用unittest.TestCase-but的子类时才会发生-- py.test文档似乎说它与un
我正在尝试为我的程序运行一个diff cov,但是我仍然有一个信息:testFile.txt sCoverage.py warning: No data was collected.,即使在代码中仍然有未测试的函数(在我的示例中是function diff)。下面是我测试命令py.test --cov=testcov.py的代码示例。我正在使用python 2.7.9
def suma(x,y):
z = x + y
return z
def diff(x,y):
return x-y
if __name__ == "__main__":
a