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

Add HookImpl.__repr__ #156

Merged
merged 2 commits into from
Jul 2, 2018
Merged

Add HookImpl.__repr__ #156

merged 2 commits into from
Jul 2, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jul 1, 2018

This is helpful when debugging hooks being called.

Example:

<HookImpl plugin_name='testmon', plugin_file='/path/to/plugin.py'>

Using "<HookImpl plugin=%r>" % (self.plugin,) instead would result in:

<HookImpl plugin=<module 'testmon.tox_testmon' from '/path/to/plugin.py'>>

This is helpful when debugging hooks being called.

Example:

> <HookImpl plugin_name='testmon', plugin_file='/path/to/plugin.py'>
pluggy/hooks.py Outdated
def __repr__(self):
return "<HookImpl plugin_name=%r, plugin_file=%r>" % (
self.plugin_name,
self.plugin.__file__,
Copy link
Member

Choose a reason for hiding this comment

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

wouldnt this completely fall appart for class instance based plugins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed - using repr() now on the plugin.

As for the test: how would I test the non-instance based plugins? (as used with tox for example)
btw: I've tried to use instance based plugins with tox (tarpas/pytest-testmon#107), but it seems to have been just ignored then.

Copy link
Contributor

@goodboy goodboy left a comment

Choose a reason for hiding this comment

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

Looks good thanks @blueyed!

@goodboy goodboy merged commit dad903c into pytest-dev:master Jul 2, 2018
@blueyed blueyed deleted the repr branch July 2, 2018 21:15
@blueyed
Copy link
Contributor Author

blueyed commented Jul 2, 2018

@tgoodlet
Thanks for the review and merging it.

It was intended to be squash-merged though…

@goodboy
Copy link
Contributor

goodboy commented Jul 2, 2018

@blueyed ahh shoot yeah I didn't look at the history in detail. It's no big deal we've had verbosity in the history like this before. Normally I just commit --amend for this kind of thing. Thanks again for the work :)

@blueyed
Copy link
Contributor Author

blueyed commented Jul 3, 2018

commit --amend

Yeah. OTOH it makes reviewing new changes and/or seeing how it evolved much easier using git commit --fixup/--squash.

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.

3 participants