Skip to content

Commit 89ab5a3

Browse files
authored
Ignore user configuration in configuration reload test (#2903)
1 parent 989117e commit 89ab5a3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ addopts = [
135135
"--cov-report=html:test-reports/coverage_html",
136136
"--html=test-reports/report.html",
137137
]
138-
log_cli_level = "INFO"
139138
env = {MPLBACKEND = "Agg"}
139+
filterwarnings = [
140+
"ignore:Do not instantiate `Config` objects directly:UserWarning"
141+
]
142+
log_cli_level = "INFO"
140143
log_level = "WARNING"
141144
minversion = "6"
142145
markers = [

tests/unit/config/test_config_object.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,17 @@ def test_config_key_error():
6363
config["invalid_key"]
6464

6565

66-
def test_reload(cfg_default):
66+
def test_reload(
67+
monkeypatch: pytest.MonkeyPatch,
68+
tmp_path: Path,
69+
cfg_default: Config,
70+
) -> None:
6771
"""Test `Config.reload`."""
72+
monkeypatch.setattr(
73+
esmvalcore.config._config_object,
74+
"USER_CONFIG_DIR",
75+
tmp_path,
76+
)
6877
cfg = Config()
6978

7079
cfg.reload()

0 commit comments

Comments
 (0)