8000 Enhance GaussDB Compatibility and Optimize Test Suite by pangpang20 · Pull Request #6 · HuaweiCloudDeveloper/gaussdb-python · GitHub
[go: up one dir, main page]

Skip to content

Enhance GaussDB Compatibility and Optimize Test Suite #6

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

Merged
merged 10 commits into from
May 26, 2025

Conversation

pangpang20
Copy link

Description

This pull request addresses compatibility issues with GaussDB, removes unsupported features, and optimizes the test suite for improved reliability and performance. Key changes include removing the test_multirange.py test file due to GaussDB's incompatibility with multirange types, simplifying server-side float rounding logic, enhancing timezone and binary format handling for datetime types, and adjusting test fixtures to function scope for better test isolation.

Changes

  • Removed test_multirange.py: Deleted the test file (436 lines) as GaussDB does not support multirange types, ensuring compatibility with the target database.
  • Simplified _server_rounds: Modified fix_faker.py to always return True for float rounding checks, removing unnecessary server version checks.
  • Improved Datetime Compatibility: Updated test_datetime.py to enhance timezone and binary format handling:
    • Added checks to skip unsupported years (≤1 or ≥9999) in binary format for timestamptz tests.
    • Improved timezone offset validation for consistency across configurations.
    • Removed unsupported negative interval tests for CockroachDB compatibility.
  • Adjusted Test Fixtures: Changed testcomp and testrange fixtures in test_composite.py and test_range.py to function scope to ensure proper initialization of composite and range types, improving test reliability.
  • Skipped Invalid Test Case: Added logic in test_string.py to skip test_dump_zero when using PyFormat.BINARY on GaussDB, as it allows null characters in strings.
  • Merged Updates: Synced with the master branch to incorporate the latest changes.

Impact

  • Total Changes: 13 additions, 450 deletions.
  • Testing: All changes have been tested locally to ensure compatibility with GaussDB and no regressions in existing functionality.
  • Performance: Simplified logic and reduced test scope improve execution time and maintainability.

Notes

  • These changes are specific to GaussDB compatibility but maintain functionality for other supported databases like PostgreSQL and CockroachDB.
  • Further validation on production GaussDB instances is recommended.

pangpang20 added 10 commits May 22, 2025 11:04
…ows null characters in strings, preventing test failure
…re created and cleaned up per test, preventing interference
…ows null characters in strings, preventing test failure
…re created and cleaned up per test, preventing interference
- Use `extract(timezone from ...)` for precise timezone offset comparison.
- Skip binary tests for datetimes with unsupported extreme years (<=1 or >=9999) to avoid psycopg DataError.
- Drop redundant negative interval test cases.
@5xuanwen 5xuanwen merged commit cda0904 into HuaweiCloudDeveloper:master May 26, 2025
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
0