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

loader, plugin: load decorated callables only #1936

Merged

Conversation

Exirel
Copy link
Contributor

@Exirel Exirel commented Sep 11, 2020

Description

Fix #859 and that's it.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

@Exirel Exirel added the Bugfix Generally, PRs that reference (and fix) one or more issue(s) label Sep 11, 2020
@Exirel Exirel added this to the 7.1.0 milestone Sep 11, 2020
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

There's one question in line notes. Besides that, I'm also curious if it would be useful to add the _sopel_callable attribute to the relevant tests in test/test_plugin.py—maybe even some assert not hasattr()s for decorators that aren't supposed to add it? Just a thought. 😸

sopel/loader.py Outdated Show resolved Hide resolved
@Exirel Exirel requested a review from dgw September 13, 2020 10:02
@Exirel
Copy link
Contributor Author

Exirel commented Sep 13, 2020

maybe even some assert not hasattr()s for decorators that aren't supposed to add it?

My initial approach was to test the behaviour of the loader function, more than anything else. After all I decided to add a "protected" attribute (starting with _), as to make it not public.

So yeah, I'm still not sure. The behaviour is tested, and I added some corner cases to make sure everything is handled properly. So I feel like it's OK.

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

Just one typo to fix while you're squashing. :shipit:

test/test_loader.py Outdated Show resolved Hide resolved
@Exirel Exirel force-pushed the plugin-collect-decorated-callables-only branch from af5b532 to ad8397c Compare September 14, 2020 07:01
@Exirel
Copy link
Contributor Author

Exirel commented Sep 14, 2020

Done.

@dgw dgw merged commit daaef67 into sopel-irc:master Sep 21, 2020
@Exirel Exirel deleted the plugin-collect-decorated-callables-only branch May 1, 2021 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module members with attributes named interval, rule, etc. confused for decorated functions
2 participants