Skip to content

feat: parallel testing infrastructure - #20

Merged
vistart merged 10 commits into
release/v1.0.0.dev17from
feature/parallel-testing
Aug 28, 2026
Merged

vistart merged 10 commits into
release/v1.0.0.dev17from
feature/parallel-testing

Conversation

@vistart

@vistart vistart commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Feature: Parallel Testing Infrastructure

Summary

Implements parallel testing capabilities for rhosocial-activerecord backends, introducing a two-level execution classification system and comprehensive cross-schema query test coverage.

Changes

Parallel Testing Plugin

  • feat: parallel-testing plugin with database pool and serial mechanism
    • New plugin infrastructure enabling parallel test execution
    • Database pool management for concurrent test runs
    • Serial execution mechanism for test isolation

Test Suite Enhancements

  • feat: cross-schema ActiveQuery/ActiveRecord tests

    • Comprehensive cross-schema query and ActiveRecord test coverage
  • feat: default-vs-non-default schema operation coverage

    • Tests covering both default and non-default schema operations
  • feat: shared expression round-trip test utilities

    • Reusable expression round-trip test helpers for all backends
  • test(query): comprehensive JOIN capability coverage

    • Full JOIN capability contract tests
  • fix(testsuite): gate CTE error-handling and context tests on basic CTE support

    • Proper capability gating for CTE tests
  • fix(testsuite): only inject dialect into heuristic construction when accepted

    • Bug fix for dialect injection in heuristic construction
  • fix(test): accept two-part column refs in schema-model qualifier contract

    • Fix two-part column reference handling in contract

Documentation

  • docs: add two-level execution classification (一级/二级) to feature README
    • Defines Level 1 (basic, relation, query) and Level 2 (events, mixins, interface, examples) execution order
    • Clarifies execution ordering for backend integration validation

Test Plan

Note: python-activerecord-testsuite is a shared test suite library. It is installed into individual backend virtual environments and does not have its own CI/CD pipeline.

Run this test suite using backend-specific configurations:

PYTHONPATH=src <venv>/bin/pytest tests/ -v --tb=short

Related Issues

Targets release: release/v1.0.0.dev17

- add parallel-testing plugin: pytest_addoption, serial markers, worker
  database pinning, dynamic slot acquire/release, session-start slot prep
- make clear-on-acquire optional per backend
- sanitize lock filename base to support path-based databases
…E support

Add @requires_protocol(CTESupport, 'supports_basic_cte') to the error-handling
and connection-context test classes in the CTE query feature that construct
CTEQuery/AsyncCTEQuery directly, so backends without basic CTE support
(MySQL 5.6/5.7) skip them instead of failing inside CTEQuery.__init__.

Also teach the query conftest's check_protocol_requirements fixture to
resolve models from sync_pool_and_model / async_pool_and_model, which the
connection-of CTE context tests rely on.
Move heuristic construction, special-constructor registry, and
dict/JSON/XML round-trip assertion helpers into the backend-agnostic
testsuite package so core and all database backends reuse one source.

- _placeholder_for/_try_construct build instances from __init__ signatures
- register_special_constructor/register_all handle validation-heavy classes
- assert_params_equal recurses into BaseExpression and dataclass params
- roundtrip_expression / sql_consistent verify lossless serialization
…accepted

Value-object DataType classes (e.g. MySQLYearType, PostgresBitType) declare
no dialect parameter; passing dialect=kwd failed construction. Only inject
when the class signature contains 'dialect'.
New feature/query/cross_schema package: two models bound to explicit
non-default schemas (ar_crm.customers / ar_shop.orders) joined, counted,
written and scoped via ActiveQuery. Tests declare
@requires_protocol(SchemaSupport, 'supports_schema') so backends without
schema namespaces skip declaratively; provisioning is an optional
provider method (setup_schema_fixtures), absent providers skip too.
Mixed-schema fixtures subclass existing fixtures and override __schema_name__,
so identical DDL is provisioned in the default namespace and SCHEMA_A.
Covers coexistence, namespace-scoped PK lookup, scoped update/delete and
cross-schema joins between default users and schema-qualified orders.
- join types: LEFT NULL-row semantics, RIGHT preservation, FULL OUTER,
  CROSS cartesian, mixed-type chains, STRAIGHT_JOIN equivalence
- USING-clause joins incl. mutual-exclusivity with ON
- true self-joins via runtime-derived aliased proxies (Node tree)
- JOIN x GROUP BY/HAVING aggregation, IN-subquery composition
- column-qualifier form contracts (two-part columns under joins,
  schema ranges without three-part references, alias-only addressing)
- fix gating: use testsuite.utils.requires_protocol so the tuple marker
  is honoured; raw pytest.mark two-arg form silently bypassed skips
@vistart vistart self-assigned this Aug 28, 2026
@sonarqubecloud

Copy link
Copy Markdown

@vistart
vistart merged commit b24e19e into release/v1.0.0.dev17 Aug 28, 2026
2 checks passed
vistart added a commit that referenced this pull request Sep 27, 2026
* feat: parallel-testing plugin with database pool and serial mechanism

- add parallel-testing plugin: pytest_addoption, serial markers, worker
  database pinning, dynamic slot acquire/release, session-start slot prep
- make clear-on-acquire optional per backend
- sanitize lock filename base to support path-based databases

* fix(testsuite): gate CTE error-handling and context tests on basic CTE support

Add @requires_protocol(CTESupport, 'supports_basic_cte') to the error-handling
and connection-context test classes in the CTE query feature that construct
CTEQuery/AsyncCTEQuery directly, so backends without basic CTE support
(MySQL 5.6/5.7) skip them instead of failing inside CTEQuery.__init__.

Also teach the query conftest's check_protocol_requirements fixture to
resolve models from sync_pool_and_model / async_pool_and_model, which the
connection-of CTE context tests rely on.

* feat(testsuite): add shared expression round-trip test utilities

Move heuristic construction, special-constructor registry, and
dict/JSON/XML round-trip assertion helpers into the backend-agnostic
testsuite package so core and all database backends reuse one source.

- _placeholder_for/_try_construct build instances from __init__ signatures
- register_special_constructor/register_all handle validation-heavy classes
- assert_params_equal recurses into BaseExpression and dataclass params
- roundtrip_expression / sql_consistent verify lossless serialization

* fix(testsuite): only inject dialect into heuristic construction when accepted

Value-object DataType classes (e.g. MySQLYearType, PostgresBitType) declare
no dialect parameter; passing dialect=kwd failed construction. Only inject
when the class signature contains 'dialect'.

* feat(query): cross-schema ActiveQuery/ActiveRecord tests

New feature/query/cross_schema package: two models bound to explicit
non-default schemas (ar_crm.customers / ar_shop.orders) joined, counted,
written and scoped via ActiveQuery. Tests declare
@requires_protocol(SchemaSupport, 'supports_schema') so backends without
schema namespaces skip declaratively; provisioning is an optional
provider method (setup_schema_fixtures), absent providers skip too.

* feat(testsuite): default-vs-non-default schema operation coverage

Mixed-schema fixtures subclass existing fixtures and override __schema_name__,
so identical DDL is provisioned in the default namespace and SCHEMA_A.
Covers coexistence, namespace-scoped PK lookup, scoped update/delete and
cross-schema joins between default users and schema-qualified orders.

* test(query): comprehensive JOIN capability coverage

- join types: LEFT NULL-row semantics, RIGHT preservation, FULL OUTER,
  CROSS cartesian, mixed-type chains, STRAIGHT_JOIN equivalence
- USING-clause joins incl. mutual-exclusivity with ON
- true self-joins via runtime-derived aliased proxies (Node tree)
- JOIN x GROUP BY/HAVING aggregation, IN-subquery composition
- column-qualifier form contracts (two-part columns under joins,
  schema ranges without three-part references, alias-only addressing)
- fix gating: use testsuite.utils.requires_protocol so the tuple marker
  is honoured; raw pytest.mark two-arg form silently bypassed skips

* fix(test): accept two-part column refs in schema-model qualifier contract

* docs: add two-level execution classification (一级/二级) to feature README

* chore: add changelog fragment for PR #20

(cherry picked from commit b24e19e)
@vistart
vistart deleted the feature/parallel-testing branch October 1, 2026 03:53
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.

1 participant