Issue #21925: Fix test_warnings for release mode

Use -Wd comment line option to log the ResourceWarning.
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py
index 633b2ac..fffadad 100644
--- a/Lib/test/test_warnings/__init__.py
+++ b/Lib/test/test_warnings/__init__.py
@@ -962,12 +962,12 @@
         # don't import the warnings module
         # (_warnings will try to import it)
         code = "f = open(%a)" % __file__
-        rc, out, err = assert_python_ok("-c", code)
+        rc, out, err = assert_python_ok("-Wd", "-c", code)
         self.assertTrue(err.startswith(expected), ascii(err))
 
         # import the warnings module
         code = "import warnings; f = open(%a)" % __file__
-        rc, out, err = assert_python_ok("-c", code)
+        rc, out, err = assert_python_ok("-Wd", "-c", code)
         self.assertTrue(err.startswith(expected), ascii(err))