Open taranu opened 1 week ago
Uhhh it would be incredibly surprising if anything in pytest-randomly was doing more than incidentally triggering this. My guess would be that it's one of the things that pytest-randomly imports that's actually fiddling with something that the function relies on.
Try editing your local copy to remove the optional imports, like xdist, factory boy, etc.:
I think it will be a bug in one of those, or indeed pybind11 or Python 3.12.
Python Version
3.12
pytest Version
8.3.3
Package Version
3.15.0
Description
Making a simple pybind11 module that binds a function calling
ostringstream.str()
appears to break in pytest withpytest-randomly
on py3.12 (but not 3.11). To reproduce:testrandomly.cc
Compiled with conda-forge provided g++ 14.1.0 and pybind11 2.13.1 by:
g++ -Wall -shared -fPIC -std=c++17 $(python3 -m pybind11 --includes) testrandomly.cc -o testrandomly$(python3-config --extension-suffix)
test_randomly.py
pytest --randomly-seed=0 test_randomly.py
works on py3.11 with any seed.pytest -p no:randomly test_randomly.py
also works on py3.12.pytest --randomly-seed=0 test_randomly.py
fails on py3.12 with any seed like so:std::to_string
works just fine, hence I suspect that this is a strange interaction with ostringstream. It's possible that this is a pybind11 or py3.12 bug but I figured I'd file an issue here first because I can only reproduce it with pytest-randomly enabled and can't guess at why.