2025-04-06 13:21:54 +03:00
|
|
|
import os
|
2025-04-14 23:02:35 +03:00
|
|
|
import runpy
|
2025-04-06 13:21:54 +03:00
|
|
|
import sys
|
|
|
|
|
2025-04-14 23:02:35 +03:00
|
|
|
# Build the module path from the test file
|
2025-04-06 13:21:54 +03:00
|
|
|
filepath = sys.argv[1]
|
2025-04-14 23:02:35 +03:00
|
|
|
project_root = os.path.dirname(__file__)
|
2025-04-06 13:21:54 +03:00
|
|
|
relpath = os.path.relpath(filepath, project_root)
|
2025-04-14 23:02:35 +03:00
|
|
|
module_path = relpath.replace('/', '.').replace('\\', '.').removesuffix('.py')
|
2025-04-06 13:21:54 +03:00
|
|
|
|
2025-04-14 23:02:35 +03:00
|
|
|
# Run manage.py in-process so breakpoints work
|
|
|
|
sys.argv = ["manage.py", "test", module_path]
|
|
|
|
runpy.run_path("manage.py", run_name="__main__")
|