Skip to content

Commit

Permalink
fix: ensure multiproc dir is created
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
  • Loading branch information
aarnphm committed Oct 27, 2022
1 parent c27dc07 commit ecc5cf8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/unit/test_metrics.py
@@ -1,9 +1,14 @@
from __future__ import annotations

from typing import TYPE_CHECKING

import bentoml
from bentoml._internal.configuration.containers import BentoMLContainer
from bentoml._internal.server.metrics.prometheus import PrometheusClient

if TYPE_CHECKING:
from _pytest.tmpdir import TempPathFactory


def test_metrics_initialization():
o = bentoml.metrics.Gauge(name="test_metrics", documentation="test")
Expand All @@ -16,8 +21,8 @@ def test_metrics_initialization():
assert isinstance(o, bentoml.metrics._LazyMetric)


def test_metrics_type():
client = PrometheusClient()
def test_metrics_type(tmp_path_factory: TempPathFactory):
client = PrometheusClient(multiproc_dir=str(tmp_path_factory.mktemp("metrics")))
with BentoMLContainer.metrics_client.patch(client):
o = bentoml.metrics.Counter(name="test_metrics", documentation="test")
assert o._attr == "Counter"
Expand Down

0 comments on commit ecc5cf8

Please sign in to comment.