Opened 8 years ago

Closed 8 years ago

#27368 closed Cleanup/optimization (fixed)

mail.tests.SMTPBackendTests.test_server_login generates ResourceWarning unclosed socket

Reported by: Jon Dufresne Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

$ python -Wall runtests.py --failfast mail.tests.SMTPBackendTests.test_server_login
Testing against Django installed in '/home/jon/devel/django/django' with up to 4 processes
Creating test database for alias 'default'...
Creating test database for alias 'other'...
/usr/lib64/python3.5/socket.py:646: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 50632), raddr=('127.0.0.1', 36317)>
  self._sock = None
.
----------------------------------------------------------------------
Ran 1 test in 0.048s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

Change History (4)

comment:1 by Jon Dufresne, 8 years ago

Has patch: set

comment:2 by Claude Paroz, 8 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Claude Paroz, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by GitHub <noreply@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 9b9c8c4:

Fixed #27368 -- Modifed BaseEmailBackend.enter() to close the connection if an exception occurs.

Fixes unclosed socket ResourceWarning in mail test.

Thanks Claude Paroz for the review.

Note: See TracTickets for help on using tickets.
Back to Top