From a4cc1efdf295346ec43e0c58b7514ca7e288bf22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=8E=AE=20=28Jade=20Lin=29?= Date: Fri, 19 Jun 2026 11:21:14 +0800 Subject: [PATCH] Upgrade pytest and requests --- Makefile | 4 ++-- conftest.py | 18 ++++++--------- pdm.lock | 26 +++++++++++----------- pyproject.toml | 2 +- scripts/requirements/requirements-dev.txt | 12 +++++----- scripts/requirements/requirements-docs.txt | 6 ++--- 6 files changed, 32 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 3764066..6dd5205 100644 --- a/Makefile +++ b/Makefile @@ -55,10 +55,10 @@ check-all: pre-commit run --all-files test: - pdm run pytest -q -x --ff --nf + env -u PYTHONPATH pdm run pytest -q -x --ff --nf vtest: - pdm run pytest -vv -x --ff --nf + env -u PYTHONPATH pdm run pytest -vv -x --ff --nf cov: rm -rf .coverage diff --git a/conftest.py b/conftest.py index 8425ca1..d812bbf 100644 --- a/conftest.py +++ b/conftest.py @@ -6,23 +6,19 @@ from sybil.parsers.rest import DocTestParser, PythonCodeBlockParser -ignore_collect = sum( - ( - [str(p.absolute()) for p in Path().glob(pattern)] - for pattern in ["jsonpath/lark_parser.py"] - ), - [], -) +ignore_collect = { + p.absolute() + for pattern in ["jsonpath/lark_parser.py"] + for p in Path().glob(pattern) +} -def pytest_ignore_collect(path, config): +def pytest_ignore_collect(collection_path, config): """return True to prevent considering this path for collection. This hook is consulted for all files and directories prior to calling more specific hooks. """ - # https://docs.pytest.org/en/5.4.3/reference.html?highlight=pytest_ignore_collect#_pytest.hookspec.pytest_ignore_collect - # noqa: B950 - if str(path) in ignore_collect: + if collection_path.absolute() in ignore_collect: return True return False diff --git a/pdm.lock b/pdm.lock index d45b7dc..54edcd3 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "build-readme", "docs", "parser", "test"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:8cde55d7003115472f788c435960269239244826d0ceb0a6c920129d5ab223d5" +content_hash = "sha256:33c1d2c4640d17d8bfa28365dd79d27b6dc458f8d8ba93afe1a26e6168e7d126" [[metadata.targets]] requires_python = ">=3.10" @@ -599,22 +599,22 @@ files = [ [[package]] name = "pytest" -version = "8.4.2" -requires_python = ">=3.9" +version = "9.1.0" +requires_python = ">=3.10" summary = "pytest: simple powerful testing with Python" groups = ["test"] dependencies = [ "colorama>=0.4; sys_platform == \"win32\"", "exceptiongroup>=1; python_version < \"3.11\"", - "iniconfig>=1", - "packaging>=20", + "iniconfig>=1.0.1", + "packaging>=22", "pluggy<2,>=1.5", "pygments>=2.7.2", "tomli>=1; python_version < \"3.11\"", ] files = [ - {file = "pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79"}, - {file = "pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01"}, + {file = "pytest-9.1.0-py3-none-any.whl", hash = "sha256:8ebb0e7888bdf2bdfc602ec51f8f62d50200af37356c74e503c79a94f5c81f32"}, + {file = "pytest-9.1.0.tar.gz", hash = "sha256:41dd9148c08072446394cefd3d79701701335a9f4cae69ba92e39f6c7f5c061c"}, ] [[package]] @@ -634,19 +634,19 @@ files = [ [[package]] name = "requests" -version = "2.32.5" -requires_python = ">=3.9" +version = "2.34.2" +requires_python = ">=3.10" summary = "Python HTTP for Humans." groups = ["docs"] dependencies = [ - "certifi>=2017.4.17", + "certifi>=2023.5.7", "charset-normalizer<4,>=2", "idna<4,>=2.5", - "urllib3<3,>=1.21.1", + "urllib3<3,>=1.26", ] files = [ - {file = "requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6"}, - {file = "requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf"}, + {file = "requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0"}, + {file = "requests-2.34.2.tar.gz", hash = "sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index ce59d77..15c20b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,5 +57,5 @@ lock = ["-S", "inherit_metadata,no_cross_platform"] [tool.pdm.dev-dependencies] docs = ["sphinx~=7.4", "livereload~=2.6", "lark~=1.2", "tornado>=6.3.2"] -test = ["pytest-cov~=5.0", "pytest~=8.0", "pexpect~=4.8", "sybil~=8.0"] +test = ["pytest-cov~=5.0", "pytest~=9.0", "pexpect~=4.8", "sybil~=8.0"] build_readme = ["pygments~=2.8", "docutils>=0.16"] diff --git a/scripts/requirements/requirements-dev.txt b/scripts/requirements/requirements-dev.txt index cff2e0c..840a0a3 100644 --- a/scripts/requirements/requirements-dev.txt +++ b/scripts/requirements/requirements-dev.txt @@ -307,15 +307,15 @@ ptyprocess==0.7.0 \ pygments==2.20.0 \ --hash=sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f \ --hash=sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176 -pytest==8.4.2 \ - --hash=sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01 \ - --hash=sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79 +pytest==9.1.0 \ + --hash=sha256:41dd9148c08072446394cefd3d79701701335a9f4cae69ba92e39f6c7f5c061c \ + --hash=sha256:8ebb0e7888bdf2bdfc602ec51f8f62d50200af37356c74e503c79a94f5c81f32 pytest-cov==5.0.0 \ --hash=sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652 \ --hash=sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857 -requests==2.32.5 \ - --hash=sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6 \ - --hash=sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf +requests==2.34.2 \ + --hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \ + --hash=sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed snowballstemmer==3.0.1 \ --hash=sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064 \ --hash=sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895 diff --git a/scripts/requirements/requirements-docs.txt b/scripts/requirements/requirements-docs.txt index 65ba465..7c5bcf9 100644 --- a/scripts/requirements/requirements-docs.txt +++ b/scripts/requirements/requirements-docs.txt @@ -199,9 +199,9 @@ packaging==26.0 \ pygments==2.20.0 \ --hash=sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f \ --hash=sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176 -requests==2.32.5 \ - --hash=sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6 \ - --hash=sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf +requests==2.34.2 \ + --hash=sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0 \ + --hash=sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed snowballstemmer==3.0.1 \ --hash=sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064 \ --hash=sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895