Skip to content

deprecate reconnect parameter of ping()#790

Merged
methane merged 4 commits into
PyMySQL:mainfrom
methane:deprecate-reconnect
Jun 12, 2026
Merged

deprecate reconnect parameter of ping()#790
methane merged 4 commits into
PyMySQL:mainfrom
methane:deprecate-reconnect

Conversation

@methane

@methane methane commented Jun 12, 2026

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.28%. Comparing base (e2a908b) to head (65bb040).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #790      +/-   ##
==========================================
+ Coverage   88.86%   90.28%   +1.41%     
==========================================
  Files           7        7              
  Lines         548      556       +8     
==========================================
+ Hits          487      502      +15     
+ Misses         61       54       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR deprecates the reconnect parameter of Connection.ping() by emitting a DeprecationWarning when callers pass the argument, and adds a regression test to ensure the warning is raised.

Changes:

  • Emit DeprecationWarning when ping(reconnect=...) is used.
  • Update ping() docstring to describe the deprecation.
  • Add a test asserting conn.ping(False) warns.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_connection.py Adds a test expecting a deprecation warning when ping(False) is called.
src/MySQLdb/_mysql.c Implements the deprecation warning and updates the ping() docstring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/MySQLdb/_mysql.c Outdated
Comment thread tests/test_connection.py Outdated
Comment on lines +33 to +36
conn = connection_factory()
with pytest.warns(DeprecationWarning, match="reconnect parameter"):
conn.ping(False)
conn.close()

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/MySQLdb/_mysql.c
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@methane methane merged commit 94412ad into PyMySQL:main Jun 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants