Skip to content

[Feature]: Add Mock Tests for the Hugging Face Parser #28

Description

@pipe1os

Problem Description

Running pytest --cov=src reveals that src/modelinfo/parsers/huggingface.py has 0% test coverage. Since the project aims to be zero-dependency (no pytest-responses or requests-mock), we need to mock the standard library urllib.request.urlopen.

Proposed Solution

  1. Create a tests/test_huggingface.py file.
  2. Use unittest.mock.patch to intercept urllib.request.urlopen and return dummy byte streams (JSON metadata and 8-byte SafeTensors header lengths) so we can test the parsing logic entirely offline.

Alternatives Considered

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions