Skip to content

Instantly share code, notes, and snippets.

@joequery
Created December 16, 2013 16:48
Show Gist options
  • Select an option

  • Save joequery/7990173 to your computer and use it in GitHub Desktop.

Select an option

Save joequery/7990173 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment