joequery
12/16/2013 - 4:48 PM

testing django apps using django_discover_runner. Allows you to specify paths so you can use linux file autocompletion.

testing django apps using django_discover_runner. Allows you to specify paths so you can use linux file autocompletion.

#!/usr/bin/env python

import sys
import subprocess
if len(sys.argv) != 2:
    exit("Improper usage. Do pytest test/path/to/tests.someTestCase.some_test")

command_list = ["python", "manage.py", "test"]
test_path = sys.argv[1].replace("/", ".")
command_list.append(test_path)
subprocess.call(command_list)