Skip to content

Guard access to __code__ #387

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

Merged
merged 1 commit into from
May 20, 2024
Merged

Guard access to __code__ #387

merged 1 commit into from
May 20, 2024

Conversation

imjoehaines
Copy link
Contributor

Goal

We read __code__ when setting a custom delivery object and when sending sessions in order to warn when a custom Delivery implementation doesn't have an options parameter

However, this breaks when using a Mock object as __code__ does not exist, nor can it be mocked

This PR adds a guard before reading __code__ so that we avoid a crash if it does not exist. We don't warn in this case as real delivery implementations should always have __code__ available, so a warning is likely to be just noise when running tests

Testing

Added a unit test using a Mock object for delivery

@imjoehaines imjoehaines merged commit c0efcc0 into next May 20, 2024
@imjoehaines imjoehaines deleted the guard-access-to-code branch May 20, 2024 08:02
@imjoehaines imjoehaines mentioned this pull request May 22, 2024
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