{python3_06} Python3: fix tests init - exceptions and string#216
{python3_06} Python3: fix tests init - exceptions and string#216anarcat merged 1 commit intolinkchecker:masterfrom
Conversation
tests/__init__.py
Outdated
| import pytest | ||
| from contextlib import contextmanager | ||
| from linkcheck import LinkCheckerInterrupt | ||
| from builtins import str |
There was a problem hiding this comment.
I'm not familiar with future. Is this equivalent to str = unicode on Python 2?
I'm not sure I like that, it seems very subtle. I much prefer the approach six took where you have a new six.text_type to mean unicode on Python 2 and str on Python 3.
(Still, this is test code, I'm not going to veto anything.)
|
Rebased on master for build checks. |
|
Rebased again and updated for |
mgedmin
left a comment
There was a problem hiding this comment.
LGTM if you fix that one thing
tests/__init__.py
Outdated
| pytest.skip("%s is not available" % name) | ||
| return func(*args, **kwargs) | ||
| newfunc.func_name = func.func_name | ||
| newfunc.__name = func.__name__ |
There was a problem hiding this comment.
Typo: __name should be __name__.
In fact I suggest using @functools.wraps(func) to decorate the def newfunc instead of copying metadata by hand. It'll also take care to copy __doc__ and __module__ and all sorts of other important things.
There was a problem hiding this comment.
Good to know. Added wraps.
No description provided.