Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
353c03f
commit caa3c27
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Test close() and __del__()""" | ||
|
||
import os | ||
import pymysql | ||
|
||
# pymysql.connections.DEBUG = True | ||
# pymysql._auth.DEBUG = True | ||
|
||
host = "127.0.0.1" | ||
port = 3306 | ||
|
||
def test_close(): | ||
con = pymysql.connect(user="nopass_sha256", host=host, port=port, ssl=None) | ||
con.close() | ||
|
||
def test_del(): | ||
con = pymysql.connect(user="nopass_sha256", host=host, port=port, ssl=None) | ||
del con | ||
|
||
def test_close_and_explicit_del(): | ||
con = pymysql.connect(user="nopass_sha256", host=host, port=port, ssl=None) | ||
con.close() | ||
# Call __del__() explicitly as a test (don't do this in normal code) | ||
con.__del__() | ||
|
||
def test_explicit_del(): | ||
con = pymysql.connect(user="nopass_sha256", host=host, port=port, ssl=None) | ||
# Call __del__() explicitly as a test (don't do this in normal code) | ||
con.__del__() |