lightning/tests/tests_pytorch/loggers/conftest.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
786 B
Python
Raw Normal View History

import sys
from types import ModuleType
from unittest.mock import Mock
import pytest
@pytest.fixture()
def mlflow_mock(monkeypatch):
mlflow = ModuleType("mlflow")
mlflow.set_tracking_uri = Mock()
monkeypatch.setitem(sys.modules, "mlflow", mlflow)
mlflow_tracking = ModuleType("tracking")
mlflow_tracking.MlflowClient = Mock()
mlflow_tracking.artifact_utils = Mock()
monkeypatch.setitem(sys.modules, "mlflow.tracking", mlflow_tracking)
mlflow_entities = ModuleType("entities")
mlflow_entities.Metric = Mock()
mlflow_entities.Param = Mock()
mlflow_entities.time = Mock()
monkeypatch.setitem(sys.modules, "mlflow.entities", mlflow_entities)
mlflow.tracking = mlflow_tracking
mlflow.entities = mlflow_entities
return mlflow