Skip to content

Commit 7173183

Browse files
committed
reduce warnings in the tests
1 parent 024db7c commit 7173183

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pymc_marketing/mmm/builders/yaml.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from __future__ import annotations
1717

1818
import os
19+
import warnings
1920
from collections.abc import Mapping
2021
from pathlib import Path
2122
from typing import Any
@@ -24,6 +25,7 @@
2425
import yaml # type: ignore
2526

2627
from pymc_marketing.mmm.builders.factories import build
28+
from pymc_marketing.mmm.multidimensional import MMM
2729
from pymc_marketing.utils import from_netcdf
2830

2931

@@ -47,7 +49,7 @@ def build_mmm_from_yaml(
4749
*,
4850
X: pd.DataFrame | None = None,
4951
y: pd.DataFrame | None = None,
50-
) -> Any:
52+
) -> MMM:
5153
"""
5254
Build an MMM model from *config_path*.
5355
@@ -67,7 +69,10 @@ def build_mmm_from_yaml(
6769

6870
# 1 ─────────────────────────────────── shell (no effects yet)
6971
model_config = cfg["model"]["kwargs"] # Get model kwargs
70-
model = build(cfg["model"])
72+
73+
with warnings.catch_warnings():
74+
warnings.filterwarnings("ignore", category=DeprecationWarning)
75+
model = build(cfg["model"])
7176

7277
# 2 ──────────────────────────────── resolve covariates / target
7378
data_cfg: Mapping[str, Any] = cfg.get("data", {})

tests/mmm/builders/test_yaml.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@
1515
Tests for the YAML builder module in pymc_marketing.mmm.builders.yaml.
1616
"""
1717

18+
import warnings
1819
from pathlib import Path
1920

2021
import pandas as pd
2122
import pytest
2223
import xarray as xr
2324
import yaml
2425

25-
from pymc_marketing.mmm.builders.yaml import build_mmm_from_yaml
26+
with warnings.catch_warnings():
27+
warnings.simplefilter("ignore", FutureWarning)
28+
from pymc_marketing.mmm.builders.yaml import build_mmm_from_yaml
29+
2630
from pymc_marketing.model_config import ModelConfigError
2731

2832

0 commit comments

Comments
 (0)