From 05686d7aef5ea0ae632876567b4e59baddc9c2eb Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Mon, 14 Oct 2024 12:15:07 +0200 Subject: [PATCH] mimics `@pytest.mark.skipif` decorator with unittest --- psutil/tests/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index b33a896e3..b2047ab70 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -975,6 +975,12 @@ def warns(warning, match=None): return unittest.TestCase().assertWarns(warning) class mark: + + @staticmethod + def skipif(condition, reason=""): + """Mimics `@pytest.mark.skipif` decorator.""" + return unittest.skipIf(condition, reason) + class xdist_group: """Mimics `@pytest.mark.xdist_group` decorator (no-op)."""