From 79c838c5d43a9f4fafeb2a33a2671146cea0b4a3 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 6 Nov 2024 10:33:41 +0100 Subject: [PATCH] [3.11] gh-87846: test_io: Ignore OpenWrapper in test___all__ The deprecated `OpenWrapper` is added to the module on demand in `__getattr__`, so it might or might not show up in `dir(io)` depending on whether e.g. `test_openwrapper` was run. Add it to `not_exported` so that check__all__ ignores it when it exists. The test consistently failed on some refleaks buildbots (but not when the test is re-run, so it was only marked as a warning). Locally, it can be reproduced by running `test_openwrapper` and `test__all__`, twice: ./python -m test test_io test_io -m '*test_[o_][p_][ea][nl][wl]*' -v --- Lib/test/test_io.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 1e444d2566e855..d528b4aa287289 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -4504,6 +4504,7 @@ class CMiscIOTest(MiscIOTest): io = io name_of_module = "io", "_io" extra_exported = "BlockingIOError", + not_exported = "OpenWrapper", # deprecated, added on demand def test_readinto_buffer_overflow(self): # Issue #18025 @@ -4570,7 +4571,10 @@ class PyMiscIOTest(MiscIOTest): io = pyio name_of_module = "_pyio", "io" extra_exported = "BlockingIOError", "open_code", - not_exported = "valid_seek_flags", + not_exported = ( + "valid_seek_flags", + "OpenWrapper", # deprecated, added on demand + ) @unittest.skipIf(os.name == 'nt', 'POSIX signals required for this test.')