Skip to content

Commit

Permalink
Use wrapper for decorator instead of contextlib
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 20, 2023
1 parent e4bca36 commit f53d7ad
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions setuptools/tests/test_logging.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import functools
import inspect
import logging
import sys
from contextlib import contextmanager

import pytest

Expand Down Expand Up @@ -42,15 +42,18 @@ def test_verbosity_level(tmp_path, monkeypatch, flag, expected_level):
assert log_level_name == expected_level


@contextmanager
def flaky_on_pypy(func):
try:
func()
except AssertionError: # pragma: no cover
if IS_PYPY:
msg = "Flaky monkeypatch on PyPy (#4124)"
pytest.xfail(f"{msg}. Original discussion in #3707, #3709.")
raise
@functools.wraps(func)
def _func():
try:
func()
except AssertionError: # pragma: no cover
if IS_PYPY:
msg = "Flaky monkeypatch on PyPy (#4124)"
pytest.xfail(f"{msg}. Original discussion in #3707, #3709.")
raise

return _func


@flaky_on_pypy
Expand Down

0 comments on commit f53d7ad

Please sign in to comment.