R: Fix single test runner

This commit is contained in:
Ivan 2025-04-06 13:21:54 +03:00
parent 4dc8673ae4
commit f1faffd063
2 changed files with 11 additions and 2 deletions

4
.vscode/launch.json vendored
View File

@ -42,8 +42,8 @@
"type": "debugpy",
"request": "launch",
"cwd": "${workspaceFolder}/rsconcept/backend",
"program": "${workspaceFolder}/rsconcept/backend/manage.py",
"args": ["test", "-k", "${fileBasenameNoExtension}"],
"program": "${workspaceFolder}/rsconcept/backend/run_testfile.py",
"args": ["${file}"],
"django": true
},
{

View File

@ -0,0 +1,9 @@
import os
import sys
filepath = sys.argv[1]
project_root = os.path.join(os.path.dirname(__file__))
relpath = os.path.relpath(filepath, project_root)
module_path = relpath.replace('/', '.').replace('\\', '.').rstrip('.py')
os.system(f"python manage.py test {module_path}")