Skip to content

Add an easy way to deselect all production tests #2820

@lahwaacz

Description

@lahwaacz

Hi, I would like to execute tests while packaging for Arch Linux. However, it seems that many tests connect to the production hub at huggingface.co and obviously fail without authentication. This leads to errors like

FAILED tests/test_cache_no_symlinks.py::TestCacheLayoutIfSymlinksNotSupported::test_download_no_symlink_existing_file - huggingface_hub.errors.RepositoryNotFoundError: 401 Client Error. (Request ID: Root=1-679d17ad-01f3bb1b69a02de07cc1430b;bf122663-13d4-4203-b238-2af7d50f7aae)

Repository Not Found for url: https://huggingface.co/julien-c/dummy-unknown/resolve/main/config.json.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
Invalid credentials in Authorization header

It seems that this is coming from

def with_production_testing(func):
file_download = patch("huggingface_hub.file_download.HUGGINGFACE_CO_URL_TEMPLATE", ENDPOINT_PRODUCTION_URL_SCHEME)
hf_api = patch("huggingface_hub.constants.ENDPOINT", ENDPOINT_PRODUCTION)
return hf_api(file_download(func))

Can you add proper pytest markers such that I can easily deselect all production tests with something like pytest -m "not production"? 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions