You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it might be worth it to refactor the harness to work more like ops-in-production does.
Namely: not just initialize the charm, do things and fire events on this one instance, but rather: only initialize the charm on every event dispatch, then discard it.
This would be helpful to catch beginner mistakes such as attempting to store state into the charm object.
Also it will remove the need for workarounds like #758 and allow for easier unittesting of code containing __init__ logic (without forcing the user to remember to reinitialize_charm() for example.
The text was updated successfully, but these errors were encountered:
I think it might be worth it to refactor the harness to work more like ops-in-production does.
Namely: not just initialize the charm, do things and fire events on this one instance, but rather: only initialize the charm on every event dispatch, then discard it.
This would be helpful to catch beginner mistakes such as attempting to store state into the charm object.
Also it will remove the need for workarounds like #758 and allow for easier unittesting of code containing
__init__
logic (without forcing the user to remember toreinitialize_charm()
for example.The text was updated successfully, but these errors were encountered: