My conftest.py
@pytest.fixture(scope="class")
def prepare_test_dataframe():
try:
with pd.ExcelFile(TEST_INPUT_DIR + TEST_FILE_NAME) as xls:
for sheet_name in xls.sheet_names:
if sheet_name == "TESTSHEET1":
test_df = pd.read_excel(TEST_INPUT_DIR + TEST_FILE_NAME, sheet_name=sheet_name, header=None)
except IOError:
print("Cannot open file")
return test_df
test.py
@pytest.mark.usefixtures("prepare_test_dataframe")
class TestConvertXLS_Scad(unittest.TestCase):
def test_add_units_columns(self, prepare_test_dataframe):
test_merged_cells = [[1, 37, 1, 43], [1, 35, 1, 36]]
test_df = prepare_test_dataframe
actual_df = self.mymod.add_units_columns(test_df, test_merged_cells)
# compare results
self.assertEqual(actual_df.loc[32, "A"], 2.0)
Traceback:
TypeError: test_add_units_columns() missing 1 required positional argument: 'prepare_test_dataframe'
I've been reading through other posts and the documents, but I can't seem to resolve this issue. Where am I going wrong?