diff --git a/src/wakepy/core/method.py b/src/wakepy/core/method.py index 32df6412..981e5efd 100644 --- a/src/wakepy/core/method.py +++ b/src/wakepy/core/method.py @@ -70,7 +70,7 @@ class Method(ABC): registered anywhere)""" supported_platforms: Tuple[PlatformType, ...] = (PlatformType.ANY,) - """Lists the platforms the Method supports. If the current platform is not + r"""Lists the platforms the Method supports. If the current platform is not part of any of the platform types listed in ``method.supported_platforms``, the ``method`` is not* going to be used (when used as part of a :class:`Mode`), and the Method activation result will show a fail in the diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 8447f9a0..d572ecc4 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -32,6 +32,7 @@ def gc_collect_after_dbus_integration_tests(): # this as garbage colletion is triggered also automatically. The garbage # collection must be triggered here manually as the warnings are # ResourceWarning is only filtered away in the dbus integration tests. + # See also: comments for pytestmark in tests/integration/test_dbus_adapters.py # noqa: W505, E501 gc.collect() logger.debug("called gc.collect") diff --git a/tests/integration/test_dbus_adapters.py b/tests/integration/test_dbus_adapters.py index 339333bd..470989bc 100644 --- a/tests/integration/test_dbus_adapters.py +++ b/tests/integration/test_dbus_adapters.py @@ -18,19 +18,41 @@ from wakepy.core import DBusAddress, DBusMethod, DBusMethodCall from wakepy.dbus_adapters.jeepney import DBusNotFoundError -# For some unknown reason, when using jeepney, one will get a warning like -# this: +# For some unknown reason the D-Bus integration tests emit warnings like +# # ResourceWarning: unclosed # noqa: E501, W505 -# This is just ignored. It only triggers at *random* line, on random test when -# python does garbage collection. +# or +# ResourceWarning: unclosed # noqa: E501, W505 +# +# on garbage collection (either automatic; on any line or manual; during +# gc_collect_after_dbus_integration_tests). These warnings are expected and +# harmless. They occur either because a bug or some feature present in the DBus +# Service or the interactions with the DBus service in the integration tests. +# These do not happen during normal usage of wakepy and do not affect wakepy +# users and are therefore simply ignored. # # Ref1: https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest-mark-filterwarnings # Ref2: https://docs.pytest.org/en/7.1.x/reference/reference.html#globalvar-pytestmark +# Ref3: https://github.com/fohrloop/wakepy/issues/380 +ignore_resource_warning_regex = r"unclosed """, # noqa: E501 + # On Fedora 40 + r"""unclosed """, # noqa: E501 + ] + for warning_example in examples: + assert re.match(ignore_resource_warning_regex, warning_example) + + @pytest.mark.usefixtures("dbus_calculator_service") class TestJeepneyCalculatorService: