Skip to content

Unable to run Django tests via Sidebar #25056

Open
@msmitherdc

Description

@msmitherdc

Type: Bug

Behaviour

After upgrading to any version past 2025.4.0 (which works), this is includes prereleases, tests fail to run with result: Error during Django test execution: name 'file' is not defined

Steps to reproduce:

  1. Upgrade to any release or prerelease after 2025.4.0
  2. Try to run one or many tests using the testing sidebar after successful test discovery and they immediately fails with:
Received test ids from temp file.
MANAGE_PY_PATH env var set, running Django test suite.
Django project directory: /home/gridusr/GRiD
Django manage.py arguments: ['/home/gridusr/GRiD/manage.py', 'test', '--testrunner=django_test_runner.CustomExecutionTestRunner', '-t', '/home/gridusr/GRiD', '-v', '2', 'apps.api.tests.test_stac.TestV3StacEndpoint.test_stac_landing_page']
Error during Django test execution: name '__file__' is not defined
Finished running tests!

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2025-05-12 14:45:23.690 [info] Found 2029 test(s).
2025-05-12 14:45:28.677 [info] Running UNITTEST execution for the following test ids: apps.api.tests.test_stac.TestV3StacEndpoint.test_stac_landing_page
2025-05-12 14:45:28.677 [info] Attempting to use temp directory for test ids file, file name: test-ids-0ba4e71f4d8d86642912.txt
2025-05-12 14:45:28.678 [info] All environment variables set for unittest execution, PYTHONPATH: "/home/gridusr/GRiD:/home/gridusr/GRiD/virtualenv/production/lib/python3.13/site-packages/:/home/gridusr/.pixi/envs/default/lib/python3.13/site-packages/"
2025-05-12 14:45:28.681 [info] Running unittests for workspace /home/gridusr/GRiD with arguments: /home/gridusr/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/unittestadapter/execution.py,--udiscovery,-t,/home/gridusr/GRiD,-v,2

2025-05-12 14:45:28.681 [info] > ./virtualenv/production/bin/python ~/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/unittestadapter/execution.py --udiscovery -t . -v 2
2025-05-12 14:45:28.681 [info] cwd: .
2025-05-12 14:45:28.754 [info] Test Result named pipe /tmp/python-test-results-6872e59677162a9580b6  cancelled

Extension version: 2024.16.1
VS Code version: Code 1.100.0 (Universal) (19e0f9e681ecb8e5c09d8784acaa601316ca4571, 2025-05-07T12:48:53.763Z)
OS version: Darwin arm64 24.4.0
Modes:
Remote OS version: Linux x64 5.14.0-503.38.1.el9_5.x86_64

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.3
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• unittestArgs: "<placeholder>"
• unittestEnabled: true

experiments
• optInto: ["pythonTestAdapter"]

Installed Extensions
Extension Name Extension Id Version
autodocstring njp 0.6.1
better-git-line-blame mk1 0.2.14
debugpy ms- 2025.8.0
docker doc 0.6.0
explorer vit 1.18.1
intellicode-api-usage-examples Vis 0.2.9
js-debug ms- 1.100.0
live-server ms- 0.4.15
openapi-lint mer 1.2.0
pylint ms- 2025.2.0
python ms- 2025.6.0
python-environment-manager don 1.2.7
python-extension-pack don 1.7.0
ruff cha 2025.22.0
sql-developer Ora 25.1.1
tasks-shell-input aug 1.18.0
vscode-containers ms- 2.0.1
vscode-django bat 1.15.0
vscode-js-profile-table ms- 1.0.10
vscode-openapi 42C 4.33.2
vscode-pull-request-github Git 0.110.0
vscode-pylance ms- 2025.4.1
vscode-python-typehint njq 1.5.1
vscode-xml red 0.29.0
vscode-yaml red 1.18.0
vscodeintellicode Vis 1.3.2
System Info
Item Value
CPUs Apple M4 Max (16 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 2, 2
Memory (System) 48.00GB (1.64GB free)
Process Argv --crash-reporter-id a72f6cab-2816-469f-ba05-148bb36e6ad6
Screen Reader no
VM 0%
Item Value
Remote Container docker-registry.rsgiscx.net:443/rsgis/grid:v2.2 (griddock) @ mds-devbox
OS Linux x64 5.14.0-503.38.1.el9_5.x86_64
CPUs AMD EPYC 7R13 Processor (4 x 0)
Memory (System) 30.65GB (21.50GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551:31249599
vscod805:30301674
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
bajee813:31263137
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
31787653:31262186
3e8i5726:31271747
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
7bj51361:31289155
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

Metadata

Metadata

Assignees

Labels

area-testinginfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions