From a19e66cedde995fa856c55b179eb4c7621951960 Mon Sep 17 00:00:00 2001 From: igorgaming <69463610+igorgaming@users.noreply.github.com> Date: Mon, 30 Jun 2025 10:22:54 +0300 Subject: [PATCH] Add __file__ variable to globals in exec() --- python_files/unittestadapter/django_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_files/unittestadapter/django_handler.py b/python_files/unittestadapter/django_handler.py index 77c50efc27d0..574aee7af7fa 100644 --- a/python_files/unittestadapter/django_handler.py +++ b/python_files/unittestadapter/django_handler.py @@ -104,7 +104,7 @@ def django_execution_runner(manage_py_path: str, test_ids: List[str], args: List manage_file = manage_path.open() with argv_context, suppress_context, manage_file: manage_code = manage_file.read() - exec(manage_code, {"__name__": "__main__"}) + exec(manage_code, {"__name__": "__main__", "__file__": manage_path}) except OSError as e: raise VSCodeUnittestError("Error running Django, unable to read manage.py") from e except Exception as e: