I am trying to execute the below pytest function in loop after reading a row from file
import pandas as pd
import pytest
def test_assert_kwh(record_xml_property):
test_df=pd.read_csv('test_function.txt',sep="|",header=0)
print(test_df.head(10))
for index,row in test_df.iterrows():
test_function=row['test_function']
test_op=row['test_op']
test_class=row['test_class']
print ( "Test Function ",test_function)
assert eval(test_function)== test_op
File1.txt content :
test_function|test_op|test_class
fun_1(0,0)|0|data_transformation
fun_1(0,0)|1|data_transformation
Pytest is only getting executed once and not twice , though there are two rows in the file
O/p is coming as one passed , though there are two rows which are to be tested