mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
R: Improve single file runner
This commit is contained in:
parent
78bd97ec51
commit
5584fa9fc8
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
@ -42,8 +42,8 @@
|
||||||
"type": "debugpy",
|
"type": "debugpy",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"cwd": "${workspaceFolder}/rsconcept/backend",
|
"cwd": "${workspaceFolder}/rsconcept/backend",
|
||||||
"program": "${workspaceFolder}/rsconcept/backend/manage.py",
|
"program": "${workspaceFolder}/rsconcept/backend/run_testfile.py",
|
||||||
"args": ["test", "-k", "${fileBasenameNoExtension}"],
|
"args": ["${file}"],
|
||||||
"django": true
|
"django": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
9
rsconcept/backend/run_testfile.py
Normal file
9
rsconcept/backend/run_testfile.py
Normal 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}")
|
Loading…
Reference in New Issue
Block a user