I am instantiating this object below every time I call csv in my function. Was just wondering if there's anyway I could just instantiate the object just once? I tried to split the return csv from def csv() to another function but failed.
Code instantiating the object
def csv():
proj = Project.Project(db_name='test', json_file="/home/qingyong/workspace/Project/src/json_files/sys_setup.json")#, _id='poc_1'
csv = CSVDatasource(proj, "/home/qingyong/workspace/Project/src/json_files/data_setup.json")
return csv
Test function
def test_df(csv,df)
..............
Is your
csv
function actually apytest.fixture
? If so, you can change its scope tosession
so it will only be called once perpy.test
session.Of course, the returned data should be immutable so tests can't affect each other.