-
Notifications
You must be signed in to change notification settings - Fork 35
FIX: Remove duplicate test functions and bare except blocks #411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes microsoft#409 - Removed 28 duplicate test function definitions (~1,267 lines of dead code) - Kept the LAST occurrence of each duplicate (what Python actually runs) - test_decimal_separator_* (4 functions × 3 duplicates each) - test_lowercase_attribute (2 duplicates) - test_rowcount (1 duplicate - versions differed) - test_columns_nonexistent (1 duplicate - versions differed) - test_all_numeric_types_with_nulls (1 duplicate) - test_lob_* (4 functions × 1 duplicate each) - test_zero_length_complex_types (1 duplicate) - test_guid_with_nulls (1 duplicate) - test_datetimeoffset_with_nulls (1 duplicate) - test_decimal_conversion_edge_cases (1 duplicate) - test_fixed_length_* (3 functions × 1 duplicate each, binary version differed) - Fixed 53 bare \\�xcept:\\ blocks: - 29 replaced with \\DROP TABLE IF EXISTS\\ pattern (cleaner cleanup) - 24 replaced with \\�xcept Exception:\\ for expected error handling File reduced from 15,021 to 13,754 lines (-8.4%) All 423 tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.pybind.ddbc_bindings.cpp: 69.4%
mssql_python.pybind.ddbc_bindings.h: 69.7%
mssql_python.pybind.connection.connection.cpp: 73.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 84.1%
mssql_python.cursor.py: 84.7%🔗 Quick Links
|
Summary
Removes dead code and improves code quality in
tests/test_004_cursor.pyby eliminating 28 duplicate test function definitions and fixing 53 bare except blocks.Changes
Removed 28 duplicate test function definitions (~1,267 lines of dead code)
Python only runs the last definition when there are duplicate function names, so all earlier duplicates were dead code. This PR keeps the last (working) occurrence of each:
test_decimal_separator_*(4 functions)test_lowercase_attributetest_rowcounttest_columns_nonexistent.fetchall()test_all_numeric_types_with_nullstest_lob_*(4 functions)test_zero_length_complex_typestest_guid_with_nullstest_datetimeoffset_with_nullstest_decimal_conversion_edge_casestest_fixed_length_*(3 functions)Fixed 53 bare
except:blocksDROP TABLE IF EXISTSpattern (cleaner, no try/except needed)except Exception:for expected error handlingResults