diff --git a/src/inline/plugin.py b/src/inline/plugin.py index f2e3189..90ac731 100644 --- a/src/inline/plugin.py +++ b/src/inline/plugin.py @@ -1170,7 +1170,9 @@ def _find(self, tests, obj, module, globs, seen): ###################################################################### class InlineTestRunner: def run(self, test: InlineTest, out: List) -> None: - tree = ast.parse(test.to_test()) + test_str = test.write_imports() + test_str += test.to_test() + tree = ast.parse(test_str) codeobj = compile(tree, filename="", mode="exec") start_time = time.time() if test.timeout > 0: