Prevent HuggingFace network access during tests
This commit is contained in:
parent
c7b03eb9ab
commit
5e99b84308
2 changed files with 5 additions and 4 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
|
@ -68,8 +68,6 @@ jobs:
|
|||
run: uv run python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('Qwen/Qwen3-Embedding-0.6B')"
|
||||
- name: Run tests with coverage
|
||||
run: uv run pytest -m "not integration" --cov=haiku --cov-report=xml
|
||||
env:
|
||||
HF_HUB_OFFLINE: "1"
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -17,13 +17,14 @@ embeddings:
|
|||
vector_dim: 2560
|
||||
""")
|
||||
os.environ["HAIKU_RAG_CONFIG_PATH"] = str(_test_config_path)
|
||||
os.environ["HF_HUB_OFFLINE"] = "1"
|
||||
|
||||
import pydantic_ai.models # noqa: E402
|
||||
import pytest # noqa: E402
|
||||
import yaml # noqa: E402
|
||||
from datasets import Dataset, load_dataset, load_from_disk # noqa: E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from datasets import Dataset
|
||||
from vcr import VCR
|
||||
|
||||
setattr(pydantic_ai.models, "ALLOW_MODEL_REQUESTS", False)
|
||||
|
|
@ -31,7 +32,9 @@ logging.getLogger("vcr.cassette").setLevel(logging.WARNING)
|
|||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def qa_corpus() -> Dataset:
|
||||
def qa_corpus() -> "Dataset":
|
||||
from datasets import Dataset, load_dataset, load_from_disk
|
||||
|
||||
ds_path = Path(__file__).parent / "data" / "dataset"
|
||||
ds_path.mkdir(parents=True, exist_ok=True)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue