I'm trying to mock the below code snippet out, but have been hitting a wall.
with open(file_path, 'wb') as f:
f.write(b''.join(byte_data))
In the test where I'm trying to mock this out, I don't actually want a file to be written too. I actually don't even care if the file is opened.
There are multiple calls to open
with arbitrary file_path
. Ideally, this whole chuck would be mocked out.
I have tried using the mock_open
helper, but not getting it to work.
In general I would like to just patch builtins.open
and also whatever needs to be patched to patch the f.write(b''.join(byte_data))
portion of the code.