Portal/rsconcept/backend/run_testfile.py
Ivan 0bdfe67fb1
Some checks failed
Backend CI / build (3.12) (push) Waiting to run
Backend CI / notify-failure (push) Blocked by required conditions
Frontend CI / build (22.x) (push) Has been cancelled
Frontend CI / notify-failure (push) Has been cancelled
F: Implement create-block API
2025-04-14 23:09:10 +03:00

14 lines
414 B
Python

import os
import runpy
import sys
# Build the module path from the test file
filepath = sys.argv[1]
project_root = os.path.dirname(__file__)
relpath = os.path.relpath(filepath, project_root)
module_path = relpath.replace('/', '.').replace('\\', '.').removesuffix('.py')
# Run manage.py in-process so breakpoints work
sys.argv = ["manage.py", "test", module_path]
runpy.run_path("manage.py", run_name="__main__")