[3.11] gh-87846: test_io: Ignore OpenWrapper in test___all__ by encukou · Pull Request #126478 · python/cpython (original) (raw)

@pablogsal, are you interested in fixing 3.11 buildbots that consistently warn, rather than fail?


test_io fails if test_openwrapper runs before test___all__. This consistently happens on some refleaks buildbots, for example Windows or Fedora, but it's only marked as a warning: when only test___all__ is re-run in a fresh process, it succeeds.

Locally, this can be reproduced by running test_openwrapper and test__all__, twice (since in a single run, test_openwrapper comes after test___all__). I don't know of a more elegant way than:

./python -m test test_io test_io -m '*test_[o_][p_][ea][nl][wl]*' -v

The reason is that the deprecated OpenWrapper is added to the module on demand in __getattr__, after which it shows up in dir(io).

Add it to not_exported so that check__all__ ignores it when it exists.