Closed Embeddave closed 3 years ago
I get a related error when calling np.load
with a LocalPath
as well:
E TypeError: open() argument 2 must be str, not int
Please migrate to tmppath-factory, pytest is working on removing local path usage so we can deprecate it to eventually phase it out
I see, thank you for clarifying. Will do. Going ahead and closing this
Hi maintainers, I'm using
pytest
'stmpdir_factory
to create a bunch of paths to mockednumpy
.npy
files (just random number arrays) that I then return from a fixture.But when I call
np.save
to save the arrays to the paths built with a directory fromtmpdir_factory
, I'm getting aUnicodeDecodeError
:Turns out this is because my
npy_path
is apy._path.local.LocalPath
instance.My fixture looks something like this:
so, when the returned factory function calls
np.save
I get that error:A simple workaround is just to cast to
str
.Not sure how concerned you all are with this but I didn't find related issues so I thought I'd report it, in case anyone else runs into the same thing.