Skip to content

Commit

Permalink
Fix CI (inference tests, dataset viewer user, mypy) (#2208)
Browse files Browse the repository at this point in the history
* add cassettes for InferenceAPI tests

* Fix dataset viewer user

* fix mypy

* set UV_HTTP_TIMEOUT
  • Loading branch information
Wauplin authored Apr 9, 2024
1 parent b2a8768 commit dc824a5
Show file tree
Hide file tree
Showing 13 changed files with 863 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/python-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ on:
jobs:
check_code_quality:
runs-on: ubuntu-latest
env:
UV_HTTP_TIMEOUT: 600 # max 10min to install deps

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
jobs:
build-ubuntu:
runs-on: ubuntu-latest
env:
UV_HTTP_TIMEOUT: 600 # max 10min to install deps

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -139,6 +142,7 @@ jobs:
runs-on: windows-latest
env:
DISABLE_SYMLINKS_IN_WINDOWS_TESTS: 1
UV_HTTP_TIMEOUT: 600 # max 10min to install deps
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion src/huggingface_hub/inference/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

if TYPE_CHECKING:
import numpy as np
from PIL import Image
from PIL.Image import Image

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/huggingface_hub/inference/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

if TYPE_CHECKING:
from aiohttp import ClientResponse, ClientSession
from PIL import Image
from PIL.Image import Image

# TYPES
UrlT = str
Expand Down
2 changes: 1 addition & 1 deletion src/huggingface_hub/inference/_generated/_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

if TYPE_CHECKING:
import numpy as np
from PIL import Image
from PIL.Image import Image

logger = logging.getLogger(__name__)

Expand Down
351 changes: 351 additions & 0 deletions tests/cassettes/InferenceApiTest.test_inference_missing_input.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions tests/cassettes/InferenceApiTest.test_inference_overriding_task.yaml

Large diffs are not rendered by default.

166 changes: 166 additions & 0 deletions tests/cassettes/InferenceApiTest.test_simple_inference.yaml

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions tests/cassettes/InferenceApiTest.test_text_to_image.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/test_inference_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pathlib import Path
from unittest.mock import patch

import pytest
from PIL import Image

from huggingface_hub import hf_hub_download
Expand All @@ -23,6 +24,7 @@
from .testing_utils import expect_deprecation, with_production_testing


@pytest.mark.vcr
@with_production_testing
class InferenceApiTest(unittest.TestCase):
def read(self, filename: str) -> bytes:
Expand Down
2 changes: 1 addition & 1 deletion tests/testing_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Used to create repos that we don't own (example: for gated repo)
# Token is not critical. Also public in https://github.com/huggingface/datasets-server
OTHER_USER = "DSSUser"
OTHER_USER = "DVUser"
OTHER_TOKEN = "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"

ENDPOINT_PRODUCTION = "https://huggingface.co"
Expand Down

0 comments on commit dc824a5

Please sign in to comment.