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

testing: allow lazy init of boto client #25

Merged
merged 2 commits into from
Jun 28, 2021

Conversation

offbyone
Copy link
Contributor

@offbyone offbyone commented Jun 26, 2021

Initializing the SecretsManager as an attr factory caused the client to
be initialized too early to mock it out with moto for unit testing, as
was called out in #24.

Until python-attrs/attrs#573 is fixed, we need to manually lazy-init the
client for SecretsManager

Pull Request Check List

This is just a friendly reminder about the most common mistakes. Please make sure that you tick all boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!

If an item doesn't apply to your pull request, check it anyway to make it apparent that there's nothing left to do.

  • Added tests for changed code.
  • Updated documentation for changed code.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives. Find the appropriate next version in our __init__.py file.
  • Documentation in .rst files is written using semantic newlines.
  • Changes (and possible deprecations) are documented in the changelog.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

Initializing the SecretsManager as an attr factory caused the client to
be initialized too early to mock it out with moto for unit testing, as
was called out in hynek#24.

Until python-attrs/attrs#573 is fixed, we need to manually lazy-init the
client for SecretsManager
@offbyone offbyone force-pushed the aws-sm-unit-testing branch 2 times, most recently from 929ee4b to 2b808ec Compare June 27, 2021 06:43
Copy link
Owner

@hynek hynek left a comment

Choose a reason for hiding this comment

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

I know too little about SM to meaningfully review, but code looks ok to me.

Can I haz changelog entry? Please add a "Python 2.7 support dropped" under the "breaking" section too.

I mean, you _can_ import awssm, but the tests don't work on 2.7 any
more.
@offbyone offbyone force-pushed the aws-sm-unit-testing branch from 2b808ec to 30929fe Compare June 28, 2021 14:12
@hynek hynek merged commit 2351063 into hynek:main Jun 28, 2021
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