Imagine we have the following fixture
@pytest.fixture()
def read_file(self):
df =pd.read_excel(Path+file_name)
return df
Basically it just reads a file and returns it as a dataframe. However, from my understanding if we use the same fixture in multiple tests, it will do the same process again and again, which has a higher cost. Is there a way to read that file in a test that I have and somehow that dataframe to be kept in memory so it can be used in other tests as well?