test(integration): MySQL 8 + Postgres 16 con Testcontainers#9
Merged
Merged
Conversation
Cierra la cadena de la v2 verificando que el query builder, el upsert, las transacciones y el ORM funcionan contra motores reales. Estructura - `tests/integration/` con marker `@pytest.mark.integration`. Por defecto los unit tests deseleccionan este marker (configurado en `pyproject.toml` con `-m 'not integration'`). - Conftest que arranca los contenedores una vez por sesión y entrega una `ShibaConnection` lista por test. `SHIBA_SKIP_INTEGRATION=1` los salta sin Docker. Cobertura por dialecto - MySQL: CREATE TABLE con AUTO_INCREMENT, INSERT/SELECT/UPDATE/DELETE, count + order_by, upsert (`ON DUPLICATE KEY UPDATE`), rollback de transacción con excepción, ORM end-to-end con `Model.save/find/where`. - Postgres: lo mismo más PK `GENERATED ALWAYS AS IDENTITY` (verifica numeración 1, 2) y upsert (`ON CONFLICT DO UPDATE`). Dependencias - `testcontainers[mysql,postgres]>=4.7` añadido a `[dev]`. CI - Workflow extendido con dos jobs: `unit` (matriz 3.10–3.13) que sigue bloqueando merges, e `integration` (3.12) que arranca contenedores reales después de unit. Ubuntu-latest ya viene con Docker. Estado - 114 unit (deseleccionados los 7 integration por default). - 7 integration verdes localmente (39s end-to-end). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
ShibaRoPinoo
added a commit
that referenced
this pull request
May 18, 2026
Consolida en un solo commit el trabajo de los PRs #5–#9 (cuyas ramas quedaron divergentes tras varios force-pushes para fix de CI). El detalle por fase vive en los PRs cerrados. Fase 0 — Seguridad y estructura - Paquete `shiba/` modular con core/ agnóstico y dialects/. - SQL injection cerrada: valores parametrizados, identificadores validados y citados por dialecto. - Catálogo `SHIBA-XYZW` de error codes con mapper desde drivers. - Excepciones tipadas, transacciones explícitas, context manager. - `shibamysql/` shim deprecated. - Tooling: pyproject.toml, ruff, mypy --strict, pytest, CI. Fase 1 — Query builder rico - `or_where`, `where_in/not_in/null/not_null/like/between`, `where_group(callback)`, `where_json(col, path, value)`. - `group_by`, `having`, `find`, `exists`, `pluck`, agregados. - `paginate`, `chunk`, `iterate`. - `upsert(data, on=[...])`, `truncate`, `raw` escape hatch. Fase 1.5 — ORM híbrido tipado - `Model` con metaclass que lee anotaciones por MRO con `inspect.get_annotations(eval_str=True)`. - 12 subclases de `Field` (PrimaryKey, String, Json, DateTime, DecimalField, Enum, ForeignKey, ...) e inferencia automática. - `ModelQuery[T]` hidrata filas a instancias. - Conexión global (`set_default_connection`) o por clase (`__db__`). Fase 2 — PostgreSQL - Dialect con doble comilla, `JSONB`, `BYTEA`, `TIMESTAMP`, `GENERATED ALWAYS AS IDENTITY`, `ON CONFLICT DO UPDATE`. - Driver psycopg3 con import perezoso (dep opcional). - `shiba.connect("mysql://...")`/`postgres://...` factory. Fase 4 — Tests de integración - 7 tests sobre MySQL 8 y Postgres 16 con Testcontainers, marker `integration`, job CI separado. Stats - 114 unit tests + 7 integration verdes (39s end-to-end). - ruff y mypy --strict limpios sobre 25 archivos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ShibaRoPinoo
added a commit
that referenced
this pull request
May 18, 2026
Consolida en un solo commit el trabajo de los PRs #5–#9 (cuyas ramas quedaron divergentes tras varios force-pushes para fix de CI). El detalle por fase vive en los PRs cerrados. Fase 0 — Seguridad y estructura - Paquete `shiba/` modular con core/ agnóstico y dialects/. - SQL injection cerrada: valores parametrizados, identificadores validados y citados por dialecto. - Catálogo `SHIBA-XYZW` de error codes con mapper desde drivers. - Excepciones tipadas, transacciones explícitas, context manager. - `shibamysql/` shim deprecated. - Tooling: pyproject.toml, ruff, mypy --strict, pytest, CI. Fase 1 — Query builder rico - `or_where`, `where_in/not_in/null/not_null/like/between`, `where_group(callback)`, `where_json(col, path, value)`. - `group_by`, `having`, `find`, `exists`, `pluck`, agregados. - `paginate`, `chunk`, `iterate`. - `upsert(data, on=[...])`, `truncate`, `raw` escape hatch. Fase 1.5 — ORM híbrido tipado - `Model` con metaclass que lee anotaciones por MRO con `inspect.get_annotations(eval_str=True)`. - 12 subclases de `Field` (PrimaryKey, String, Json, DateTime, DecimalField, Enum, ForeignKey, ...) e inferencia automática. - `ModelQuery[T]` hidrata filas a instancias. - Conexión global (`set_default_connection`) o por clase (`__db__`). Fase 2 — PostgreSQL - Dialect con doble comilla, `JSONB`, `BYTEA`, `TIMESTAMP`, `GENERATED ALWAYS AS IDENTITY`, `ON CONFLICT DO UPDATE`. - Driver psycopg3 con import perezoso (dep opcional). - `shiba.connect("mysql://...")`/`postgres://...` factory. Fase 4 — Tests de integración - 7 tests sobre MySQL 8 y Postgres 16 con Testcontainers, marker `integration`, job CI separado. Stats - 114 unit tests + 7 integration verdes (39s end-to-end). - ruff y mypy --strict limpios sobre 25 archivos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Cierra la cadena de la v2 verificando contra MySQL 8 y Postgres 16 reales con Testcontainers. 7/7 verdes localmente (~39s end-to-end).
Cobertura por motor
MySQL (`tests/integration/test_mysql_e2e.py`)
Postgres (`tests/integration/test_postgres_e2e.py`)
Mecánica
CI
`.github/workflows/ci.yml` ahora tiene dos jobs:
Test plan
🤖 Generated with Claude Code