Skip to content

fix(#25): Handle polymorphic_on with CASE statement - #192

Draft
winwinashwin wants to merge 9 commits into
mainfrom
ashwin/contrib-3
Draft

fix(#25): Handle polymorphic_on with CASE statement#192
winwinashwin wants to merge 9 commits into
mainfrom
ashwin/contrib-3

Conversation

@winwinashwin

Copy link
Copy Markdown
Contributor

No description provided.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 33313654229

Coverage increased (+0.02%) to 95.995%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 64 uncovered changes across 3 files (1376 of 1440 lines covered, 95.56%).
  • 2 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
tests/plugins/test_activity.py 75 13 17.33%
sqlalchemy_history/model_builder.py 10 9 90.0%
tests/builders/test_table_builder.py 29 28 96.55%
Total (68 files) 1440 1376 95.56%

Coverage Regressions

2 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
sqlalchemy_history/model_builder.py 1 98.44%
tests/plugins/test_activity.py 1 20.69%

Coverage Stats

Coverage Status
Relevant Lines: 5868
Covered Lines: 5633
Line Coverage: 96.0%
Coverage Strength: 9.54 hits per line

💛 - Coveralls

For every test, we were creating the engine and disposing it right away.
This is not required and is rather expensive for databases like oracle
and postgres. Instead use a single engine fixture with relevant scope.

For oracle, this has reduced the time taken for tests by 4-5x
Make session fixtures opt-in, avoiding connection and DDL overhead for
roughly 105 of 292 source test methods that don’t require a session.
Keep model setup and versioning cleanup automatic, and detach
pure mapper-argument tests from TestCase.
Create models and tables once per test class, then isolate individual tests with rollback-only transactions. Preserve mapper-only test optimization by skipping database setup for classes that do not
require it.

Reduces SQLite suite runtime from ~18.4s to ~7.4s, Oracle suite from 3m to ~50s.
@winwinashwin
winwinashwin marked this pull request as draft August 31, 2026 07:54
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