Support extras in stubtest_third_party.py (#8467)

This commit is contained in:
Kevin Kirsche
2022-08-18 17:12:36 -04:00
committed by GitHub
parent a8c8178127
commit 8c51fab4e2
12 changed files with 20 additions and 10 deletions

View File

@@ -1,2 +0,0 @@
html5lib
lxml

View File

@@ -1 +1,4 @@
version = "4.11.*"
[tool.stubtest]
extras = ["lxml", "html5lib"]

View File

@@ -1,2 +0,0 @@
genshi
lxml

View File

@@ -1 +1,4 @@
version = "1.1.*"
[tool.stubtest]
extras = ["all"]

View File

@@ -1 +0,0 @@
PySocks>=1.5.6, !=1.5.7

View File

@@ -1,2 +1,5 @@
version = "2.28.*"
requires = ["types-urllib3<1.27"] # keep in sync with requests's setup.py
[tool.stubtest]
extras = ["socks"]

View File

@@ -2,5 +2,3 @@ tensorflow
pandas
dask
rich
requests
slack-sdk

View File

@@ -1 +1,4 @@
version = "4.64.*"
[tool.stubtest]
extras = ["slack", "telegram"]

View File

@@ -1 +0,0 @@
PySocks>=1.5.6,<2.0,!=1.5.7

View File

@@ -1 +1,4 @@
version = "1.26.*"
[tool.stubtest]
extras = ["socks"]

View File

@@ -14,7 +14,7 @@ from packaging.requirements import Requirement
from packaging.version import Version
metadata_keys = {"version", "requires", "extra_description", "obsolete_since", "no_longer_updated", "tool"}
tool_keys = {"stubtest": {"skip", "apt_dependencies", "ignore_missing_stub"}}
tool_keys = {"stubtest": {"skip", "apt_dependencies", "extras", "ignore_missing_stub"}}
allowed_files = {"README.md"}

View File

@@ -41,8 +41,11 @@ def run_stubtest(dist: Path, *, verbose: bool = False) -> bool:
python_exe = str(venv_dir / "bin" / "python")
dist_version = metadata["version"]
extras = stubtest_meta.get("extras", [])
assert isinstance(dist_version, str)
dist_req = f"{dist.name}=={dist_version}"
assert isinstance(extras, list)
dist_extras = ", ".join(extras)
dist_req = f"{dist.name}[{dist_extras}]=={dist_version}"
# If @tests/requirements-stubtest.txt exists, run "pip install" on it.
req_path = dist / "@tests" / "requirements-stubtest.txt"