Monkeypatching pandas series to_csv with pytest
I am testing a function, write_query()
, in module.py. My test is in test_module.py. I am trying to monkeypatch Series.to_csv()
to prevent file writing. It works in part – my monkeypatched function performs checks that seem to complete, and raises an error that is expected and indicates a passed test (I did this so I could explicitly include a test in the test function, rather than calling the function in a test and have the test performed in the function alone). However, it is still writing a file, doesnt_matter
, and I’m not sure why. Can anyone explain?
Monkeypatching pandas series to_csv with pytest
I am testing a function, write_query()
, in module.py. My test is in test_module.py. I am trying to monkeypatch Series.to_csv()
to prevent file writing. It works in part – my monkeypatched function performs checks that seem to complete, and raises an error that is expected and indicates a passed test (I did this so I could explicitly include a test in the test function, rather than calling the function in a test and have the test performed in the function alone). However, it is still writing a file, doesnt_matter
, and I’m not sure why. Can anyone explain?
Monkeypatching pandas series to_csv with pytest
I am testing a function, write_query()
, in module.py. My test is in test_module.py. I am trying to monkeypatch Series.to_csv()
to prevent file writing. It works in part – my monkeypatched function performs checks that seem to complete, and raises an error that is expected and indicates a passed test (I did this so I could explicitly include a test in the test function, rather than calling the function in a test and have the test performed in the function alone). However, it is still writing a file, doesnt_matter
, and I’m not sure why. Can anyone explain?