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

Injection framework raising exceptions when resolving from an extesion during test cases #49

Open
timsavage opened this issue Jun 14, 2020 · 2 comments
Assignees
Labels
🐛 bug This issue has been reviewed and accepted as a bug 💡 enhancement This issue/pr has been reviewed and accepted as an enhancement
Milestone

Comments

@timsavage
Copy link
Collaborator

Extensions are loaded at application startup causing factories to be registered. In test cases however, this step does not get executed leading to exceptions.

A workaround is to load extensions in conftest.py (pytest) and call their ready method to cause factories to be registered.

@timsavage timsavage added the 🐛 bug This issue has been reviewed and accepted as a bug label Jun 14, 2020
@timsavage timsavage added this to the 4.3.1 milestone Jun 14, 2020
@timsavage timsavage self-assigned this Jun 14, 2020
@timsavage
Copy link
Collaborator Author

timsavage commented Jun 14, 2020

This issue also manifests using an inject on a cli command. A better solution may be to delay when injection is resolved to first call and cache the result.

@timsavage timsavage changed the title Injection framework raising exceptions when resolving from an extesion Injection framework raising exceptions when resolving from an extesion during test cases Jul 12, 2020
@timsavage timsavage modified the milestones: 4.3.1, 4.4 Jul 12, 2020
@timsavage
Copy link
Collaborator Author

A solution to this issue would also be useful for applications that do not use CliApplication, a helper method that initialises extensions and uses that to load all settings, including those in extensions. This would bypass this problem

@timsavage timsavage added the 💡 enhancement This issue/pr has been reviewed and accepted as an enhancement label Sep 6, 2020
@timsavage timsavage modified the milestones: 4.4, 4.5 Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug This issue has been reviewed and accepted as a bug 💡 enhancement This issue/pr has been reviewed and accepted as an enhancement
Projects
None yet
Development

No branches or pull requests

1 participant