Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions resources/unittest_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ def _load_user_module(result_writer, exit_wrapper: _EXIT_WRAPPER_TYPE) -> Module
exit_wrapper(5)

_module = ModuleType("module")
# It's necessary to manually add the module to the sys modules
# Dataclasses do not add themselves which causes issues for us with this type of dynamic loading
# if from __future__ import annotations is also used
# See: https://github.com/mkdocs/mkdocs/issues/3141 and https://github.com/sqlalchemy/alembic/issues/1419
sys.modules[_module.__name__] = _module

exec(code, _module.__dict__)

return _module
Expand Down
Loading