diff --git a/src/wuttaweb/forms/schema.py b/src/wuttaweb/forms/schema.py index 0dabf64..3d0e08b 100644 --- a/src/wuttaweb/forms/schema.py +++ b/src/wuttaweb/forms/schema.py @@ -250,12 +250,13 @@ class ObjectRef(colander.SchemaType): *args, **kwargs, ): + # nb. allow session injection for tests + self.session = kwargs.pop('session', Session()) super().__init__(*args, **kwargs) self.request = request self.config = self.request.wutta_config self.app = self.config.get_app() self.model_instance = None - self.session = Session() if empty_option: if empty_option is True: