Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
One more resource warning about unclosed resource being garbage collected. As per the other tests I think transport and protocol need to be closed as per below patch but someone can verify if it's the right approach. ./python.exe -X tracemalloc -Wall -m test test_asyncio -m test_create_datagram_endpoint_reuse_address_warning 0:00:00 load avg: 2.45 Run tests sequentially 0:00:00 load avg: 2.45 [1/1] test_asyncio /Users/kasingar/stuff/python/cpython/Lib/test/support/__init__.py:1722: ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=17, laddr=('127.0.0.1', 62353)> gc.collect() Object allocated at (most recent call last): File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/base_events.py", lineno 1331 sock = socket.socket( /Users/kasingar/stuff/python/cpython/Lib/asyncio/selector_events.py:694: ResourceWarning: unclosed transport <_SelectorDatagramTransport fd=6> _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) Object allocated at (most recent call last): File "/Users/kasingar/stuff/python/cpython/Lib/asyncio/selector_events.py", lineno 84 return _SelectorDatagramTransport(self, sock, protocol, == Tests result: SUCCESS == 1 test OK. Total duration: 373 ms Tests result: SUCCESS diff --git Lib/test/test_asyncio/test_base_events.py Lib/test/test_asyncio/test_base_events.py index 6c0f00dc93..338f35c8dd 100644 --- Lib/test/test_asyncio/test_base_events.py +++ Lib/test/test_asyncio/test_base_events.py @@ -1814,7 +1814,9 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): reuse_address=False) with self.assertWarns(DeprecationWarning): - self.loop.run_until_complete(coro) + transport, protocol = self.loop.run_until_complete(coro) + transport.close() + self.loop.run_until_complete(protocol.done) @patch_socket def test_create_datagram_endpoint_nosoreuseport(self, m_socket): After patch there are no resource warnings for the test. ./python.exe -X tracemalloc -Wall -m test test_asyncio -m test_create_datagram_endpoint_reuse_address_warning 0:00:00 load avg: 2.09 Run tests sequentially 0:00:00 load avg: 2.09 [1/1] test_asyncio == Tests result: SUCCESS == 1 test OK. Total duration: 349 ms Tests result: SUCCESS ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37228> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com