mirror of
https://github.com/hanzoai/anomalib.git
synced 2026-10-30 18:48:11 +00:00
The previous commit was meant to remove .github/workflows and removed every tracked path instead — 892 files, the whole repo. This puts back the 874 that were never in scope; the eighteen workflow files stay gone, for the reasons that commit gives. Content is byte-identical to 9d2aec9 outside .github/workflows.
22 lines
1.0 KiB
Python
22 lines
1.0 KiB
Python
"""Test benchmarking pipeline."""
|
|
|
|
# Copyright (C) 2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
from anomalib.pipelines import Benchmark
|
|
|
|
|
|
@patch("anomalib.pipelines.benchmark.job.Engine", return_value=MagicMock(test=MagicMock(return_value=[{"test": 1}])))
|
|
@patch("anomalib.pipelines.benchmark.generator.get_model", return_value=MagicMock())
|
|
@patch("anomalib.pipelines.benchmark.generator.get_datamodule", return_value=MagicMock(category="dummy"))
|
|
def test_benchmark_pipeline(engine: MagicMock, model: MagicMock, datamodule: MagicMock) -> None: # noqa: ARG001 | this is needed for patching
|
|
"""Test benchmarking pipeline."""
|
|
with patch("anomalib.pipelines.benchmark.job.BenchmarkJob.save", return_value=MagicMock()) as save_method:
|
|
benchmark = Benchmark()
|
|
benchmark_parser = benchmark.get_parser()
|
|
args = benchmark_parser.parse_args(["--config", "tests/integration/pipelines/pipeline.yaml"])
|
|
benchmark.run(args)
|
|
assert len(save_method.call_args.args[0]) == 8
|