Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements-tests.txt
- run: |
pip install tomli typing_extensions
DEPENDENCIES=$(python tests/get_external_dependencies.py)
if [ -n "$DEPENDENCIES" ]; then
pip install $DEPENDENCIES
fi
- name: Get pyright version
uses: SebRollen/[email protected]
id: pyright_version
Expand Down
16 changes: 16 additions & 0 deletions tests/get_external_dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3
from __future__ import annotations

import os
import sys

from utils import read_dependencies

distributions = sys.argv[1:]

if not distributions:
distributions = os.listdir("stubs")

for distribution in distributions:
for package in read_dependencies(distribution).external_pkgs:
print(f"{package} ")
2 changes: 1 addition & 1 deletion tests/get_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
for distribution in distributions:
with open(f"stubs/{distribution}/METADATA.toml", "rb") as file:
for package in tomli.load(file).get("tool", {}).get("stubtest", {}).get(METADATA_MAPPING[platform], []):
print(package)
print(f"{package} ")
9 changes: 8 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
import venv
from collections.abc import Mapping
from functools import cache
from pathlib import Path
from typing import NamedTuple
from typing_extensions import Annotated
Expand All @@ -33,6 +32,14 @@ def colored(s: str, _: str) -> str: # type: ignore[misc]
return s


if sys.version_info >= (3, 9):
from functools import cache
else:
from functools import lru_cache

cache = lru_cache(maxsize=None)


def print_error(error: str, end: str = "\n", fix_path: tuple[str, str] = ("", "")) -> None:
error_split = error.split("\n")
old, new = fix_path
Expand Down