Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python中数据提供程序的动态值_Python_Unit Testing_Dataprovider - Fatal编程技术网

python中数据提供程序的动态值

python中数据提供程序的动态值,python,unit-testing,dataprovider,Python,Unit Testing,Dataprovider,我使用lambda作为python单元测试的数据提供程序。但是如果我发送静态变量,意味着我可以得到结果。如果我使用一些动态变量,意味着我遇到了问题。 这是我的代码 class TestOne(unittest.TestCase): data=lambda: ( ((tc.read_data_from_excel('InputData.xls','Data','DataLevel1')),), ) def setUp(self):

我使用lambda作为python单元测试的数据提供程序。但是如果我发送静态变量,意味着我可以得到结果。如果我使用一些动态变量,意味着我遇到了问题。 这是我的代码

class TestOne(unittest.TestCase):

    data=lambda: (
            ((tc.read_data_from_excel('InputData.xls','Data','DataLevel1')),),
        )


    def setUp(self):
        self.driver =webdriver.Firefox()
        self.driver.maximize_window()

    @data_provider(data)
    def test(self,username,password):        
        //coding here

这里是包含用户名和密码的excel文件,以及“从excel读取数据”的写入方法,以检索数据并作为列表返回。我哪里做错了

你有什么问题?你能提供一个stacktrace或者你得到的错误吗?测试只需要给出3个参数