Error during Django test execution: [WinError 206] The filename or extension is too long · Issue #24242 · microsoft/vscode-python (original) (raw)

Type: Bug

I have a lot of tests in my Django app and if I try to launch them all from the test explorator, I'll had an error.

  1. Run tests from test explorator panel
  2. WinError 206
args:  []
Running Django run tests with command:  ['c:\\Users\\xxxxx\\Projects\\env\\Scripts\\python.exe', 'C:\\Users\\xxxxx\\Projects\\manage.py', 'test', '--testrunner=django_test_runner.CustomExecutionTestRunner',  'test_directory.test_file.TestClass.test_method_1', 'test_directory.test_file.TestClass.test_method_2', ...]
Error during Django test execution: [WinError 206] The filename or extension is too long

The paths of each tests is part of the django unit command.
Command exceed 46500 characters and Windows can not process it (WinError 206).
Maybe it would be great when all tests in a test files is present, replace each path of the tests by the test file.
And if all tests files are present, removing all tests path ?

Example:

tests_directory/
 ├─── test_file.py
 │      ├── TestClass
 │      │      ├─ test_method_1
 │      │      └─ test_method_2
 │      └── TestClass2
 │             ├─ test_method_3
 │             └─ test_method_4
 └─── test_file_2.py
        ├── TestClass3
        │      ├─ test_method_5
        │      └─ test_method_6
        └── TestClass4
               └─ test_method_7

Here, if I want to run all tests from test_file_2.py, command arg should be tests_directory.test_file_2 instead of
tests_directory.test_file_2.TestClass3.test_method_5 tests_directory.test_file_2.TestClass3.test_method_6 tests_directory.test_file_2.TestClass4.test_method_7

Sorry if it's not clear

Extension version: 2024.17.2024100401
VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Windows_NT x64 10.0.22621
Modes:

System Info

Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1260P (16 x 2496)
GPU Status 2d_canvas: enabledcanvas_oop_rasterization: enabled_ondirect_rendering_display_compositor: disabled_off_okgpu_compositing: enabledmultiple_raster_threads: enabled_onopengl: enabled_onrasterization: enabledraw_draw: disabled_off_okskia_graphite: disabled_offvideo_decode: enabledvideo_encode: enabledvulkan: disabled_offwebgl: enabledwebgl2: enabledwebgpu: enabledwebnn: disabled_off
Load (avg) undefined
Memory (System) 31.70GB (11.53GB free)
Process Argv --crash-reporter-id 96bbfc2b-23da-4f22-8267-b6ead6cf47ab
Screen Reader no
VM 0%

A/B Experiments

vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
0ee40948:31013168
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
flighttreat:31134774
wkspc-onlycs-t:31132770
wkspc-ranged-t:31151552
cf971741:31144450
defaultse:31146405
iacca2:31150323
cc771715:31146322