Mercurial > p > roundup > code
view test/pytest_patcher.py @ 7891:3de80157606c
fix: revert markdown2 version limitation; markdown2 bug resolved
Revert this checkin since 2.4.13 with the fix is current:
changeset: 7509:46248c3ca7af
user: John Rouillard <rouilj@ieee.org>
date: Sun Jun 25 17:03:38 2023 -0400
files: .github/workflows/ci-test.yml .travis.yml
description:
markdown2 v2.4.9 is broken. Pin to 2.4.8 or earlier.
Revert when
https://github.com/trentm/python-markdown2/issues/517
is fixed.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 20 Apr 2024 12:42:49 -0400 |
| parents | 1c94afabb2cb |
| children |
line wrap: on
line source
""" The following code was taken from: https://github.com/pytest-dev/pytest/issues/568#issuecomment-216569420 to resolve a bug with using pytest.mark.skip(). Once the bug is resolved in pytest this file can be removed along with all the wrapper mark_class() references in the other test files. """ import types def mark_class(marker): '''Workaround for https://github.com/pytest-dev/pytest/issues/568''' def copy_func(f): try: return types.FunctionType(f.__code__, f.__globals__, name=f.__name__, argdefs=f.__defaults__, closure=f.__closure__) except AttributeError: return types.FunctionType(f.func_code, f.func_globals, name=f.func_name, argdefs=f.func_defaults, closure=f.func_closure) def mark(cls): if isinstance(cls, types.FunctionType): return marker(copy_func(cls)) for method in dir(cls): if method.startswith('test'): f = copy_func(getattr(cls, method)) setattr(cls, method, marker(f)) return cls return mark
