testcontainers / testcontainers/testcontainers-python

Creating a Postgres contrainer with an async driver fails

未关闭
#263 8 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

  • #320 来自 @fourteekey —— 已关闭,未合并
👀 requires attention 📦 package: postgres 🚀 enhancement
主要语言
Python
星标
2.3k
派生
386
平均合并
4 小时 40 分钟
30 天内合并 PR
1

描述

Hello,
When creating a new database container, testcontainers automatically tries to connect to it here, but if I specify an async driver (e.g. PostgresContainer("postgres:14.4", driver="asyncpg")) sqlalchemy tries to use that and fails because it's not in an async context.
Is there any way to skip trying to connect to the database or fix it so it can also handle async context?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 testcontainers/core/generic.py 第 55 行附近开始,跟踪 PostgresContainer("postgres:14.4", driver="asyncpg") 如何通过 SQLAlchemy 构建并建立连接。检查现有的 driver 选择处理方式,并参考已关闭的关联 pull request 了解上下文。完成标准是:使用异步 driver 创建容器时,在自动连接期间不再失败,并且通过测试覆盖预期的跳过行为或异步上下文行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgresql, python, sqlalchemy
领域
databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。