feat(testing): Testcontainers integration — Docker fixtures + @ServiceConnection wiring (v26.06.31)#56
Merged
Merged
Conversation
added 2 commits
June 7, 2026 11:36
…Serviceconnection wiring + bump v26.06.31 Wave 4 (final) — Spring @Testcontainers/@Serviceconnection equivalent in pyfly.testing.testcontainers: - Container factories (postgres/mysql/redis/mongodb/kafka) wrapping testcontainers (new optional extra pyfly[testcontainers]; lazy import + clear install hint). - pyfly_config_for(container) maps a started container to pyfly config keys (Postgres/MySQL->async relational.url, Redis->cache+session redis.url, Mongo->document.uri, Kafka->eda.kafka.bootstrap-servers); pyfly_config(*containers) builds a Config. - is_docker_available() + @requires_docker skip integration tests cleanly when Docker absent. Tests: tests/testing/test_testcontainers.py (10: mappings via fakes, nesting, docker-availability, extra-absent error, requires_docker skip). Gates: mypy --strict (614), ruff + format, full suite 3786 passed (+graceful skip).
CI runs --all-extras (testcontainers installed) on Docker-enabled runners, so the 'extra absent' + 'skips without docker' assumptions failed there. Replace with: - _load() against a nonexistent submodule -> RuntimeError install hint (works whether or not the extra is installed); - inspect that @requires_docker attaches a skipif mark (works whether or not Docker is up). Verified passing with testcontainers both absent and installed.
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.
Summary
Wave 4 (final) — the Spring Boot
@Testcontainers/@ServiceConnectionequivalent (pyfly.testing.testcontainers).postgres_container,mysql_container,redis_container,mongodb_container,kafka_container) wrappingtestcontainers— new optional extrapyfly[testcontainers], lazily imported with a clear install hint.@ServiceConnection-style auto-wiring:pyfly_config_for(container)maps a started container to pyfly config keys (Postgres/MySQL → asyncpyfly.data.relational.url; Redis →pyfly.cache.redis.url+pyfly.session.redis.url; Mongo →pyfly.data.document.uri; Kafka →pyfly.eda.kafka.bootstrap-servers);pyfly_config(*containers)builds a readyConfig.is_docker_available()+@requires_dockerskip integration tests cleanly when Docker / the extra is absent.Tests
tests/testing/test_testcontainers.py(10): per-type mappings via duck-typed fakes (no Docker),_nest, docker-availability, extra-absent clear error,@requires_dockerskip (verified skipping here). Real container startup is exercised by the skip path where Docker exists.Gates
mypy --strict(614) ✓ ·ruff+ruff format✓ · full suite 3786 passed, 2 skipped.Bumps
v26.06.30 → v26.06.31. Wave 4 complete. Next: Wave 5 (docs + skills/agents).