Skip to content

Commit

Permalink
Tests for close() and __del__()
Browse files Browse the repository at this point in the history
  • Loading branch information
roelschroeven committed Feb 12, 2021
1 parent 353c03f commit caa3c27
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_del.py
@@ -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__()

0 comments on commit caa3c27

Please sign in to comment.