Skip to content

Commit 44245cd

Browse files
Bump the prod-deps group across 1 directory with 7 updates (#412)
* Bump the prod-deps group with 7 updates Bumps the prod-deps group with 7 updates: | Package | From | To | | --- | --- | --- | | [matplotlib](https://github.com/matplotlib/matplotlib) | `3.10.9` | `3.11.0` | | [notebook](https://github.com/jupyter/notebook) | `7.5.6` | `7.6.0` | | [numpy](https://github.com/numpy/numpy) | `2.4.6` | `2.5.0` | | [pytest](https://github.com/pytest-dev/pytest) | `9.0.3` | `9.1.1` | | [scipy](https://github.com/scipy/scipy) | `1.17.1` | `1.18.0` | | [soundfile](https://github.com/bastibe/python-soundfile) | `0.13.1` | `0.14.0` | | [tqdm](https://github.com/tqdm/tqdm) | `4.67.3` | `4.68.3` | Updates `matplotlib` from 3.10.9 to 3.11.0 - [Release notes](https://github.com/matplotlib/matplotlib/releases) - [Commits](matplotlib/matplotlib@v3.10.9...v3.11.0) Updates `notebook` from 7.5.6 to 7.6.0 - [Release notes](https://github.com/jupyter/notebook/releases) - [Changelog](https://github.com/jupyter/notebook/blob/main/CHANGELOG.md) - [Commits](https://github.com/jupyter/notebook/compare/@jupyter-notebook/tree@7.5.6...@jupyter-notebook/tree@7.6.0) Updates `numpy` from 2.4.6 to 2.5.0 - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](numpy/numpy@v2.4.6...v2.5.0) Updates `pytest` from 9.0.3 to 9.1.1 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@9.0.3...9.1.1) Updates `scipy` from 1.17.1 to 1.18.0 - [Release notes](https://github.com/scipy/scipy/releases) - [Commits](scipy/scipy@v1.17.1...v1.18.0) Updates `soundfile` from 0.13.1 to 0.14.0 - [Release notes](https://github.com/bastibe/python-soundfile/releases) - [Commits](bastibe/python-soundfile@0.13.1...0.14.0) Updates `tqdm` from 4.67.3 to 4.68.3 - [Release notes](https://github.com/tqdm/tqdm/releases) - [Commits](tqdm/tqdm@v4.67.3...v4.68.3) --- updated-dependencies: - dependency-name: matplotlib dependency-version: 3.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: notebook dependency-version: 7.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: numpy dependency-version: 2.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: pytest dependency-version: 9.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: scipy dependency-version: 1.18.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: soundfile dependency-version: 0.14.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: tqdm dependency-version: 4.68.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps ... Signed-off-by: dependabot[bot] <support@github.com> * Bump the prod-deps group across 1 directory with 7 updates Bumps the prod-deps group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [matplotlib](https://github.com/matplotlib/matplotlib) | `3.10.9` | `3.11.0` | | [notebook](https://github.com/jupyter/notebook) | `7.5.6` | `7.6.0` | | [numpy](https://github.com/numpy/numpy) | `2.4.6` | `2.5.0` | | [pytest](https://github.com/pytest-dev/pytest) | `9.0.3` | `9.1.1` | | [scipy](https://github.com/scipy/scipy) | `1.17.1` | `1.18.0` | | [soundfile](https://github.com/bastibe/python-soundfile) | `0.13.1` | `0.14.0` | | [tqdm](https://github.com/tqdm/tqdm) | `4.67.3` | `4.68.3` | Updates `matplotlib` from 3.10.9 to 3.11.0 - [Release notes](https://github.com/matplotlib/matplotlib/releases) - [Commits](matplotlib/matplotlib@v3.10.9...v3.11.0) Updates `notebook` from 7.5.6 to 7.6.0 - [Release notes](https://github.com/jupyter/notebook/releases) - [Changelog](https://github.com/jupyter/notebook/blob/main/CHANGELOG.md) - [Commits](https://github.com/jupyter/notebook/compare/@jupyter-notebook/tree@7.5.6...@jupyter-notebook/tree@7.6.0) Updates `numpy` from 2.4.6 to 2.5.0 - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](numpy/numpy@v2.4.6...v2.5.0) Updates `pytest` from 9.0.3 to 9.1.1 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@9.0.3...9.1.1) Updates `scipy` from 1.17.1 to 1.18.0 - [Release notes](https://github.com/scipy/scipy/releases) - [Commits](scipy/scipy@v1.17.1...v1.18.0) Updates `soundfile` from 0.13.1 to 0.14.0 - [Release notes](https://github.com/bastibe/python-soundfile/releases) - [Commits](bastibe/python-soundfile@0.13.1...0.14.0) Updates `tqdm` from 4.67.3 to 4.68.3 - [Release notes](https://github.com/tqdm/tqdm/releases) - [Commits](tqdm/tqdm@v4.67.3...v4.68.3) --- updated-dependencies: - dependency-name: matplotlib dependency-version: 3.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: notebook dependency-version: 7.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: numpy dependency-version: 2.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: pytest dependency-version: 9.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: scipy dependency-version: 1.18.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: soundfile dependency-version: 0.14.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps - dependency-name: tqdm dependency-version: 4.68.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prod-deps ... Signed-off-by: dependabot[bot] <support@github.com> * add logging reset fixtures * use logging reset fixture in tests * fix check_logger fixture error message * remove check_logger(Ã) fail condition from coverage --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Gautzilla <72027971+Gautzilla@users.noreply.github.com>
1 parent c10678a commit 44245cd

5 files changed

Lines changed: 215 additions & 185 deletions

File tree

tests/conftest.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import os
55
import sys
66
import typing
7+
from collections.abc import Generator
78
from pathlib import Path
9+
from typing import Any
810
from unittest.mock import MagicMock
911

1012
import pandas as pd
@@ -173,3 +175,43 @@ def restore_config() -> typing.Generator:
173175
config.resample_quality_settings[key] = value
174176
for key, value in multiprocessing.items():
175177
config.multiprocessing[key] = value
178+
179+
180+
@pytest.fixture(autouse=True)
181+
def reset_logging() -> typing.Generator[None, typing.Any, None]:
182+
"""Reset the python logging module."""
183+
root = logging.getLogger()
184+
handlers_before = list(root.handlers)
185+
level_before = root.level
186+
187+
# Snapshot of loggers before the test
188+
loggers_before = {
189+
name: list(logger.handlers)
190+
for name, logger in logging.Logger.manager.loggerDict.items()
191+
if isinstance(logger, logging.Logger)
192+
}
193+
194+
yield
195+
root.handlers = handlers_before
196+
root.level = level_before
197+
198+
# Cleaning of the handlers of each logger:
199+
for name, logger in logging.Logger.manager.loggerDict.items():
200+
if isinstance(logger, logging.Logger):
201+
logger.handlers = loggers_before.get(name, [])
202+
203+
logging.Logger.manager.loggerDict = {
204+
key: value
205+
for key, value in logging.Logger.manager.loggerDict.items()
206+
if key in loggers_before
207+
}
208+
209+
210+
@pytest.fixture(autouse=True)
211+
def check_logger() -> Generator[None, Any, None]:
212+
h1 = list(logging.root.handlers)
213+
yield
214+
h2 = list(logging.root.handlers)
215+
if h1 != h2: # pragma: no cover
216+
msg = "This test changed the root logger handlers."
217+
raise ValueError(msg)

tests/test_export_transform.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ def return_mocked_attr(*args: list, **kwargs: dict) -> MockedArgs:
147147

148148
monkeypatch.setattr(argparse.ArgumentParser, "parse_args", return_mocked_attr)
149149

150+
# Mock setup_logging to keep the handlers of the root logger as they are
151+
monkeypatch.setattr(export_transform, "setup_logging", lambda: None)
152+
150153
parser = create_parser()
151154

152155
args = parser.parse_args()

tests/test_logging.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import importlib
21
import logging
32
import os
43
import typing
@@ -19,16 +18,9 @@ def setup_module_logging() -> None:
1918
setup_logging()
2019

2120

22-
@pytest.fixture(autouse=True)
23-
def reset_logging():
24-
"""Reset the python logging module."""
25-
yield
26-
importlib.reload(logging)
27-
28-
2921
@pytest.fixture
3022
def temp_user_logging_config(tmp_path: Path) -> Path:
31-
"""Writes a yaml logging config file in tmp_path, then returns its path.
23+
"""Writes a YAML logging config file in tmp_path, then returns its path.
3224
3325
Parameters
3426
----------
@@ -95,7 +87,6 @@ def set_user_config_env(temp_user_logging_config: Path) -> typing.Generator:
9587
The path to the logging_config.yaml user config file.
9688
9789
"""
98-
importlib.reload(logging)
9990

10091
original_config_env = os.getenv("OSMOSE_USER_CONFIG", None)
10192
os.environ["OSMOSE_USER_CONFIG"] = str(temp_user_logging_config.parent)
@@ -105,7 +96,6 @@ def set_user_config_env(temp_user_logging_config: Path) -> typing.Generator:
10596
os.environ["OSMOSE_USER_CONFIG"] = original_config_env
10697
else:
10798
del os.environ["OSMOSE_USER_CONFIG"]
108-
importlib.reload(logging)
10999

110100

111101
@pytest.mark.allow_log_write_to_file

tests/test_public_api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def test_project_build(
220220
audio_files: pytest.fixture,
221221
other_files: list[str],
222222
expected_audio_events: list[Event],
223+
monkeypatch: pytest.MonkeyPatch,
223224
) -> None:
224225
_, request = audio_files
225226
file_timezone = (
@@ -450,8 +451,7 @@ def test_reshape(
450451

451452
expected_ads_name = (
452453
transform.name
453-
if transform.name
454-
else f"{expected_ads.begin.strftime(TIMESTAMP_FORMAT_EXPORTED_FILES_UNLOCALIZED)}"
454+
or f"{expected_ads.begin.strftime(TIMESTAMP_FORMAT_EXPORTED_FILES_UNLOCALIZED)}"
455455
)
456456

457457
# The new dataset should be added to the outputs property
@@ -473,8 +473,7 @@ def test_reshape(
473473
# ads folder should match the ads name
474474
ads_folder_name = (
475475
transform.name
476-
if transform.name
477-
else f"{round(ads.data_duration.total_seconds())}_{ads.sample_rate}"
476+
or f"{round(ads.data_duration.total_seconds())}_{ads.sample_rate}"
478477
)
479478
assert ads.folder.name == ads_folder_name
480479

0 commit comments

Comments
 (0)