diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 742ec79..6a4bb3e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,7 +24,7 @@ jobs: uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} - version: 0.11.7 + version: 0.11.19 enable-cache: true cache-dependency-glob: "uv.lock" - name: Install the project diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 8ba5e86..b9ad4ab 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -40,7 +40,7 @@ jobs: with: enable-cache: true cache-dependency-glob: "uv.lock" - version: 0.11.7 + version: 0.11.19 - name: Change Package Version run: | diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index fd1cc7c..810fbaa 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -2,6 +2,8 @@ import pytest import torch from sklearn.preprocessing import LabelEncoder +from urllib.error import URLError +from urllib.request import urlopen from torchTextClassifiers import ModelConfig, TrainingConfig, torchTextClassifiers from torchTextClassifiers.dataset import TextClassificationDataset @@ -32,6 +34,14 @@ ) +def _is_huggingface_reachable() -> bool: + try: + with urlopen("https://huggingface.co", timeout=3): + return True + except URLError: + return False + + @pytest.fixture def sample_data(): """Fixture providing sample data for all tests.""" @@ -292,6 +302,9 @@ def test_huggingface_tokenizer(sample_data, model_params): """Test the full pipeline with HuggingFaceTokenizer.""" sample_text_data, categorical_data, labels = sample_data + if not _is_huggingface_reachable(): + pytest.skip("Hugging Face is unreachable in this environment") + tokenizer = HuggingFaceTokenizer.load_from_pretrained( "google-bert/bert-base-uncased", output_dim=50 )