Skip to content

Simplify mpl.testing._copy_metadata. #8102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Feb 19, 2017

mpl.testing._copy_metadata was basically doing the job
of functools.update_wrapper. We don't need to specify
compat_co_firstlineono either as pytest will look up
the lineno in the wrapped function
(https://github.com/pytest-dev/pytest/blob/master/_pytest/compat.py#L188).
It's also for this reason that we need to make sure
__wrapped__ is properly set, even on Py2.

Also remove a useless check on image_comparison (if we want an
argument to be compulsory then just mark it as such, this does not
prevent it to be passed as keyword).

`mpl.testing._copy_metadata` was basically doing the job
of `functools.update_wrapper`.  We don't need to specify
`compat_co_firstlineono` either as pytest will look up
the lineno in the wrapped function
(https://github.com/pytest-dev/pytest/blob/master/_pytest/compat.py#L188).
It's also for this reason that we need to make sure
`__wrapped__` is properly set, even on Py2.

Also remove a useless check on `image_comparison` (if we want an
argument to be compulsory then just mark it as such, this does not
prevent it to be passed as keyword).
@anntzer
Copy link
Contributor Author

anntzer commented Feb 19, 2017

Actually there's no way (AFAICT) to make this easily work because setting __wrapped__ also tells pytest to lookup the signature (and thus the fixtures to use) on the wrapped function (with no way of bypassing that, even by setting __signature__), which is not what we want here.

@anntzer anntzer closed this Feb 19, 2017
@anntzer
Copy link
Contributor Author

anntzer commented Feb 19, 2017

xref pytest-dev/pytest#2267

@anntzer anntzer deleted the simplify-copy-metadata branch June 23, 2017 09:43
@anntzer
Copy link
Contributor Author

anntzer commented Nov 28, 2017

Implmented in #9300.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants