MagicStack / MagicStack/asyncpg

Python 3.13.2: TestConnectParams.test_connect_params fails with ValueError: Invalid IPv6 URL

未关闭
#1,236 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
8.1k
派生
468
PR 合并指标
30 天内没有已合并 PR

描述

Based on historical test-builds of the python-asyncpg package in Fedora, this appears to be a regression from Python 3.13.1 to 3.13.2.

$ python3.13 --version
Python 3.13.2
$ python3.13 -m venv _e
$ . _e/bin/activate
(_e) $ pip install -e .[gssauth,test]
(_e) $ pip install pytest
(_e) $ python -m pytest
[…]
========================================================================================== short test summary info ===========================================================================================
FAILED tests/test__sourcecode.py::TestCodeQuality::test_flake8 - AssertionError: flake8 validation failed:
FAILED tests/test_codecs.py::TestCodecs::test_custom_codec_binary - asyncpg.exceptions.FeatureNotSupportedError: extension "hstore" is not available
FAILED tests/test_codecs.py::TestCodecs::test_custom_codec_text - asyncpg.exceptions.FeatureNotSupportedError: extension "hstore" is not available
FAILED tests/test_codecs.py::TestCodecs::test_extra_codec_alias - asyncpg.exceptions.FeatureNotSupportedError: extension "hstore" is not available
FAILED tests/test_codecs.py::TestCodecs::test_unhandled_type_fallback - asyncpg.exceptions.FeatureNotSupportedError: extension "isn" is not available
FAILED tests/test_codecs.py::TestCodecs::test_unknown_type_text_fallback - asyncpg.exceptions.FeatureNotSupportedError: extension "citext" is not available
FAILED tests/test_connect.py::TestConnectParams::test_connect_params - ValueError: Invalid IPv6 URL
FAILED tests/test_connect.py::TestConnectionAttributes::test_prefer_standby_picks_master_when_standby_is_down - TimeoutError
FAILED tests/test_introspection.py::TestIntrospection::test_introspection_no_stmt_cache_01 - asyncpg.exceptions.FeatureNotSupportedError: extension "hstore" is not available
FAILED tests/test_introspection.py::TestIntrospection::test_introspection_no_stmt_cache_02 - asyncpg.exceptions.FeatureNotSupportedError: extension "hstore" is not available
===================================================================== 10 failed, 300 passed, 3 skipped, 3 warnings in 132.00s (0:02:12) ======================================================================

The subject of this report is:

FAILED tests/test_connect.py::TestConnectParams::test_connect_params - ValueError: Invalid IPv6 URL

The full output for that failure is:

___________________________________________________________________________________ TestConnectParams.test_connect_params ____________________________________________________________________________________
Traceback (most recent call last):
  File "/usr/lib64/python3.13/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib64/python3.13/unittest/case.py", line 651, in run
    self._callTestMethod(testMethod)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
       ~~~~~~^^
  File "/home/ben/src/forks/asyncpg/tests/test_connect.py", line 1237, in test_connect_params
    self.run_testcase(testcase)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/ben/src/forks/asyncpg/tests/test_connect.py", line 1154, in run_testcase
    addrs, params = connect_utils._parse_connect_dsn_and_args(
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        dsn=dsn, host=host, port=port, user=user, password=password,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...   
        target_session_attrs=target_session_attrs,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        krbsrvname=krbsrvname, gsslib=gsslib)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ben/src/forks/asyncpg/asyncpg/connect_utils.py", line 282, in _parse_connect_dsn_and_args
    parsed = urllib.parse.urlparse(dsn)
  File "/usr/lib64/python3.13/urllib/parse.py", line 395, in urlparse
    splitresult = urlsplit(url, scheme, allow_fragments)
  File "/usr/lib64/python3.13/urllib/parse.py", line 516, in urlsplit
    _check_bracketed_netloc(netloc)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib64/python3.13/urllib/parse.py", line 451, in _check_bracketed_netloc
    raise ValueError("Invalid IPv6 URL")
ValueError: Invalid IPv6 URL

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

调研方向

从 tests/test_connect.py::TestConnectParams::test_connect_params 开始,并在 Python 3.13.2 上复现该失败。阅读 asyncpg/connect_utils.py 中 _parse_connect_dsn_and_args 和 urllib.parse.urlparse 附近的代码;当目标测试不再引发 ValueError: Invalid IPv6 URL 时即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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