chore: import upstream snapshot with attribution
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""Pytest configuration for som tests.
|
||||
|
||||
This module provides test fixtures for the som (Set-of-Mark) package.
|
||||
The som package depends on heavy ML models and will skip tests if not available.
|
||||
"""
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_torch():
|
||||
with patch("torch.load") as mock_load:
|
||||
mock_load.return_value = Mock()
|
||||
yield mock_load
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_icon_detector():
|
||||
with patch("omniparser.IconDetector") as mock_detector:
|
||||
instance = Mock()
|
||||
mock_detector.return_value = instance
|
||||
yield instance
|
||||
@@ -0,0 +1,73 @@
|
||||
"""Unit tests for som package (Set-of-Mark).
|
||||
|
||||
This file tests ONLY basic som functionality.
|
||||
Following SRP: This file tests som module imports and basic operations.
|
||||
All external dependencies (ML models, OCR) are mocked.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
class TestSomImports:
|
||||
"""Test som module imports (SRP: Only tests imports)."""
|
||||
|
||||
def test_som_module_exists(self):
|
||||
"""Test that som module can be imported."""
|
||||
try:
|
||||
import som
|
||||
|
||||
assert som is not None
|
||||
except ImportError:
|
||||
pytest.skip("som module not installed")
|
||||
|
||||
def test_omniparser_import(self):
|
||||
"""Test that OmniParser can be imported."""
|
||||
try:
|
||||
from som import OmniParser
|
||||
|
||||
assert OmniParser is not None
|
||||
except ImportError:
|
||||
pytest.skip("som module not available")
|
||||
except Exception as e:
|
||||
pytest.skip(f"som initialization requires ML models: {e}")
|
||||
|
||||
def test_models_import(self):
|
||||
"""Test that model classes can be imported."""
|
||||
try:
|
||||
from som import BoundingBox, ParseResult, UIElement
|
||||
|
||||
assert BoundingBox is not None
|
||||
assert UIElement is not None
|
||||
assert ParseResult is not None
|
||||
except ImportError:
|
||||
pytest.skip("som models not available")
|
||||
except Exception as e:
|
||||
pytest.skip(f"som models require dependencies: {e}")
|
||||
|
||||
|
||||
class TestSomModels:
|
||||
"""Test som data models (SRP: Only tests model structure)."""
|
||||
|
||||
def test_bounding_box_structure(self):
|
||||
"""Test BoundingBox class structure."""
|
||||
try:
|
||||
from som import BoundingBox
|
||||
|
||||
# Check the class exists and has expected structure
|
||||
assert hasattr(BoundingBox, "__init__")
|
||||
except ImportError:
|
||||
pytest.skip("som models not available")
|
||||
except Exception as e:
|
||||
pytest.skip(f"som models require dependencies: {e}")
|
||||
|
||||
def test_ui_element_structure(self):
|
||||
"""Test UIElement class structure."""
|
||||
try:
|
||||
from som import UIElement
|
||||
|
||||
# Check the class exists and has expected structure
|
||||
assert hasattr(UIElement, "__init__")
|
||||
except ImportError:
|
||||
pytest.skip("som models not available")
|
||||
except Exception as e:
|
||||
pytest.skip(f"som models require dependencies: {e}")
|
||||
Reference in New Issue
Block a user