Skip to content
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

Deprecate proc kwarg to call_historic() #143

Merged
merged 2 commits into from
May 19, 2018

Conversation

goodboy
Copy link
Contributor

@goodboy goodboy commented May 17, 2018

It's a bad name, use result_callback instead.

Resolves #120

If ``proc`` is not None it will be called for for each non-None result
obtained from a hook implementation.
If ``result_callback`` is not ``None`` it will be called for for each
non-None result obtained from a hook implementation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document that proc is deprecated in the docstring as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

he_method1.call_historic(proc=callback, kwargs=dict(arg=1))

# TODO: remove once ``proc`` is removed
if callback:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness we should also test passing result_callback. I suggest changing this test to use result_callback and create a new, simpler test, just for the deprecation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

@goodboy
Copy link
Contributor Author

goodboy commented May 18, 2018

@nicoddemus pushed all your recs.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

pluggy/hooks.py Outdated
return
# XXX: woah isn't this wrong for `firstresult` hooks?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoddemus btw did you notice this?
If i'm reading this correctly won't this code never process firstresult hooks?

Copy link
Contributor Author

@goodboy goodboy May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that loop expr is just slightly wrong should be for x in res or [res]: right?
Nope hehe.

Copy link
Contributor Author

@goodboy goodboy May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh waitttt whatttt?
Wait why not? I guess it doesn't make sense to?

pluggy/hooks.py Outdated
self._call_history.append((kwargs or {}, proc))
if proc is not None:
warnings.warn(
"Support for `proc` argument now deprecated and will be"
Copy link
Contributor Author

@goodboy goodboy May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for proc argument is now

dahhh!

It's a bad name, use `result_callback` instead.

Resolves pytest-dev#120
@goodboy
Copy link
Contributor Author

goodboy commented May 18, 2018

@nicoddemus @RonnyPfannschmidt give this one more lookover if you don't mind. I tweaked couple things and added docs.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😁

@goodboy goodboy merged commit aeb1f67 into pytest-dev:master May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants