[[Python 3.10]]でCIが通っていないかったので対応する。[[Python 3.6]]もサポートが終了しており、[[🦉Jumeaux]]の出番はまだまだありそうなため、手遅れになる前に手を打ちたい。
## ユニットテストを通す
### [[Fn.py]]の削除
[[Python 3.10]]で動作しないので削除する。
```diff
[tool.poetry.dependencies]
- fn = "^0.4.3"
```
### [[Pytest]]の最新化
[[Pytest]]が実行できなくなっているので最新にする。
`pyproject.toml`
```toml
[tool.poetry.dev-dependencies]
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
```
[[Pytest]]の最新版は[[Python 3.6]]のサポートを切っているので、[[🦉Jumeaux]]のサポートも[[Python 3.7]]以上にする。
```toml
[tool.poetry.dependencies]
python = "^3.7.0"
```
ライブラリをアップデート。
```console
$ poetry update
Package operations: 2 installs, 31 updates, 7 removals
• Removing atomicwrites (1.4.0)
• Removing importlib-metadata (4.8.3)
• Removing more-itertools (8.12.0)
• Removing py (1.11.0)
• Removing toml (0.10.2)
• Removing wcwidth (0.2.5)
• Removing zipp (3.6.0)
• Updating colorama (0.4.4 -> 0.4.6)
• Updating jmespath (0.10.0 -> 1.0.1)
• Updating pyparsing (3.0.7 -> 3.0.9)
• Updating urllib3 (1.26.8 -> 1.26.12)
• Updating attrs (21.4.0 -> 22.1.0)
• Updating botocore (1.24.2 -> 1.28.1)
• Updating certifi (2021.10.8 -> 2022.9.24)
• Installing exceptiongroup (1.0.0rc9)
• Updating idna (3.3 -> 3.4)
• Installing iniconfig (1.1.1)
• Updating charset-normalizer (2.0.12 -> 2.1.1)
• Updating ghp-import (2.0.2 -> 2.1.0)
• Updating markdown (3.3.6 -> 3.3.7)
• Updating pluggy (0.13.1 -> 1.0.0)
• Updating click (8.0.3 -> 8.1.3)
• Updating watchdog (2.1.6 -> 2.1.9)
• Updating coverage (6.2 -> 6.5.0)
• Updating jsonpickle (2.1.0 -> 2.2.0)
• Updating mkdocs (1.2.3 -> 1.4.1)
• Updating mkdocs-material-extensions (1.0.3 -> 1.1)
• Updating pytest (5.4.3 -> 7.2.0)
• Updating pathspec (0.9.0 -> 0.10.1)
• Updating platformdirs (2.4.0 -> 2.5.2)
• Updating soupsieve (2.3.1 -> 2.3.2.post1)
• Updating pytz (2021.3 -> 2022.5)
• Updating pygments (2.11.2 -> 2.13.0)
• Updating tornado (6.1 -> 6.2)
• Updating s3transfer (0.5.1 -> 0.6.0)
• Updating typing-extensions (4.1.1 -> 4.4.0)
• Updating requests (2.27.1 -> 2.28.1)
• Updating beautifulsoup4 (4.10.0 -> 4.11.1)
• Updating boto3 (1.21.2 -> 1.25.1)
• Updating pytest-cov (2.12.1 -> 4.0.0)
```
### テストを実行する
```console
make test
```
そう甘くはない。
```
..\..\..\..\AppData\Local\pypoetry\Cache\virtualenvs\jumeaux-rOBWcRiK-py3.10\lib\site-packages\deepdiff\diff.py:19: in <module>
from collections import Mapping
E ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\syoum\scoop\apps\python\current\lib\collections\__init__.py)
```
```
jumeaux\addons\__init__.py:10: in <module>
from jumeaux.models import (
E ImportError: cannot import name 'Request' from partially initialized module 'jumeaux.models' (most likely due to a circular import) (C:\Users\syoum\git\github.com\tadashi-aikawa\jumeaux\jumeaux\models.py)
```
### [[DeepDiff]]のバージョンアップ
絶対にうまく動かないけど、もうごまかせない...とりあえず最新にしてみる。
```diff
- deepdiff = "3.3.0" # sensitive
+ deepdiff = "6.2.1"
```
```console
$ poetry update
Package operations: 1 install, 1 update, 1 removal
• Removing jsonpickle (2.2.0)
• Installing ordered-set (4.1.0)
• Updating deepdiff (3.3.0 -> 6.2.1)
```
実行。
```console
make test
```
意外と結構動いた...。
```
1 failed, 186 passed, 2 warnings in 1.73s
```
明確なエラーは以下だけ。
```
E NameError: name '_' is not defined
jumeaux\executor.py:715: NameError
```
### [[Fn.py]]の実装を置き換える
以下の要領で置き換えをしていく。
```diff
- .order_by(_)
+ .order_by(lambda x: x)
```
いくつか削除したらユニットテストは通った!
## [[E2Eテスト]]を通す
```console
$ make test-e2e
=================================================================================== test session starts ===================================================================================
platform win32 -- Python 3.10.5, pytest-7.2.0, pluggy-1.0.0 -- C:\Users\syoum\AppData\Local\pypoetry\Cache\virtualenvs\jumeaux-rOBWcRiK-py3.10\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\syoum\git\github.com\tadashi-aikawa\jumeaux
plugins: cov-4.0.0
collected 23 items
e2e/main.py::TestHelp::test_usage PASSED [ 4%]
e2e/main.py::TestInit::test_with_no_args PASSED [ 8%]
e2e/main.py::TestInit::test_with_invalid_args PASSED [ 13%]
e2e/main.py::TestInit::test_simple PASSED [ 17%]
e2e/main.py::TestRun::test_simple PASSED [ 21%]
e2e/main.py::TestRun::test_path_custom PASSED [ 26%]
e2e/main.py::TestRun::test_query_custom PASSED [ 30%]
e2e/main.py::TestRun::test_all_same PASSED [ 34%]
e2e/main.py::TestRun::test_xml PASSED [ 39%]
e2e/main.py::TestRun::test_html PASSED [ 43%]
e2e/main.py::TestRun::test_ignore_order PASSED [ 47%]
e2e/main.py::TestRun::test_ignore PASSED [ 52%]
e2e/main.py::TestRun::test_force_json PASSED [ 56%]
e2e/main.py::TestRun::test_request_headers PASSED [ 60%]
e2e/main.py::TestRun::test_judge_response_headers PASSED [ 65%]
e2e/main.py::TestRun::test_with_log_level_options PASSED [ 69%]
e2e/main.py::TestRun::test_with_threads PASSED [ 73%]
e2e/main.py::TestRun::test_with_processes SKIPPED (Jumeaux doesn't support multiprocess executor in Windows.) [ 78%]
e2e/main.py::TestRun::test_root_array PASSED [ 82%]
e2e/main.py::TestRun::test_notifier PASSED [ 86%]
e2e/main.py::TestRun::test_post PASSED [ 91%]
e2e/main.py::TestRetry::test_with_empty_path PASSED [ 95%]
e2e/main.py::TestRetry::test_with_notifiers PASSED [100%]
======================================================================== 22 passed, 1 skipped in 105.80s (0:01:45) ========================================================================
```
案外すんなり通った...。[[DeepDiff]]とか絶対に問題起こると思ったのだが...。