Closed aaraney closed 3 weeks ago
This appears to not work b.c. of the way we are patching and the way we are importing pandas.read_csv
. Per the pytest
docs:
There can be many names pointing to any individual object, so for patching to work you must ensure that you patch the name used by the system under test.
So, it seems we either need to patch ngen.cal.calibration_cathment.read_csv
or change how we import and use pandas
in ngen.cal.calibration_cathment.read_csv
(e.g. import pandas as pd
). I am going to go with the second for two reasons: 1) this is the cannonical way to import pandas
in python, 2) I would do a double take if I saw:
monkeypatch.setattr("ngen.cal.calibration_cathment.read_csv", mock)
It seems best to avoid this behavior all together rather than putting in a work around.
pd.read_csv
is not being monkey patched as expected.https://github.com/NOAA-OWP/ngen-cal/blob/7bebf090e658e8385872ba04cc5a61cdbd280633/python/ngen_cal/tests/test_calibration_catchment.py#L22