From c68d81a8ca9521e81ddc32855eb584aedb51f854 Mon Sep 17 00:00:00 2001 From: Sean Breckenridge Date: Wed, 30 Sep 2020 13:53:31 -0700 Subject: [PATCH] supress conflicting regex warning --- my/core/core_config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/my/core/core_config.py b/my/core/core_config.py index b180aee..22cc87e 100644 --- a/my/core/core_config.py +++ b/my/core/core_config.py @@ -84,6 +84,8 @@ def _reset_config(): def test_active_modules() -> None: + import pytest + reset = _reset_config with reset() as cc: @@ -104,7 +106,8 @@ def test_active_modules() -> None: cc.enabled_modules = ['my.body.exercise'] assert cc._is_module_active('my.whatever' ) is None assert cc._is_module_active('my.core' ) is None - assert cc._is_module_active('my.body.exercise') is True - # todo suppress warnings during the tests? + with pytest.warns(UserWarning, match=r"conflicting regexes") as record_warnings: + assert cc._is_module_active("my.body.exercise") is True + assert len(record_warnings) == 1 ### tests end