aio-libs / aio-libs/yarl

tests/test_pydantic.py fails to collect

未關閉 適合新手
#1,872 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
1.5k
分支
215
平均合併
1 天 2 分鐘
30 天內合併 PR
13

描述

### Please confirm the following

- [ ] I agree to follow the [aio-libs Code of Conduct][CoC]

[CoC]: ../../.github/blob/master/CODE_OF_CONDUCT.md

- [X] I have checked the [current issues][issue search] for duplicates.

[issue search]: ../search?q=is%3Aissue&type=issues

- [X] I understand this is open source software provided for free and that I might not receive a timely response.
- [X] I am positive I am **NOT** reporting a (potential) security vulnerability, to the best of my knowledge. *(These must be shared by submitting [this report form][vulnerability report form] instead, if any hesitation exists.)*

[vulnerability report form]: ../security/advisories/new

- [ ] I am willing to submit a pull request with reporoducers as xfailing test cases or even entire fix. *(Assign this issue to me.)*

### Describe the bug

Not sure when it broke, but currently on FreeBSD, for either yarl 1.24.2 and 1.24.5, `tests/test_pydantic.py` fails to collect:

```
============================= test session starts ==============================
platform freebsd15 -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /usr/local/bin/python3.12
codspeed: 5.0.3 (disabled, mode: walltime, callgraph: not supported, timer_resolution: 280.0ns)
cachedir: .pytest_cache
hypothesis profile 'default'
rootdir: /work/usr/ports/www/py-yarl/work-py312/yarl-1.24.5
configfile: pytest.ini
testpaths: tests/
plugins: codspeed-5.0.3, hypothesis-6.165.10
collecting ... collected 1621 items / 1 error

==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_pydantic.py ____________________
tests/test_pydantic.py:13: in
class TstModel(pydantic.BaseModel):
/usr/local/lib/python3.12/site-packages/pydantic/main.py:197: in __new__
fields[ann_name] = ModelField.infer(
/usr/local/lib/python3.12/site-packages/pydantic/fields.py:504: in infer
return cls(
/usr/local/lib/python3.12/site-packages/pydantic/fields.py:434: in __init__
self.prepare()
/usr/local/lib/python3.12/site-packages/pydantic/fields.py:555: in prepare
self.populate_validators()
/usr/local/lib/python3.12/site-packages/pydantic/fields.py:829: in populate_validators
*(get_validators() if get_validators else list(find_validators(self.type_, self.model_config))),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/local/lib/python3.12/site-packages/pydantic/validators.py:768: in find_validators
raise RuntimeError(f'no validator found for {type_}, see `arbitrary_types_allowed` in Config')
E RuntimeError: no validator found for , see `arbitrary_types_allowed` in Config
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 1.38s ===============================
```

Pydanyic version is 1.10.20. Full build log (including all versions of dependencies) here: https://gist.github.com/AMDmi3/6eac3b8045f644ed96890aaa36281bbb

### To Reproduce

Run pytest

### Expected behavior

Test should pass

### Python Version

```console
3.12.14
```

### multidict Version

```console
6.7.1
```

### propcache Version

```console
0.4.1
```

### yarl Version

```console
1.24.5
```

### OS

FreeBSD 15.1

### Additional context

_No response_

貢獻指南

開啟貢獻指南

研究方向

Start by running pytest on tests/test_pydantic.py with Python 3.12, yarl 1.24.5, and Pydantic 1.10.20 to reproduce the collection error. Inspect the TstModel definition and its interaction with Pydantic, then run the test file and the full suite to confirm collection succeeds and the tests pass.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
testing
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
活躍
描述清晰度
基本清楚
新手友好度
70/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。