import sys
from optparse import OptionParser
from os.path import abspath, dirname
from django.test.simple import DjangoTestSuiteRunner


def runtests(*test_args, **kwargs):
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    test_runner = DjangoTestSuiteRunner(
        verbosity=kwargs.get('verbosity', 1),
        interactive=kwargs.get('interactive', False),
        failfast=kwargs.get('failfast')
    )
    failures = test_runner.run_tests(test_args)
    sys.exit(failures)

if __name__ == '__main__':
    parser = OptionParser()
    parser.add_option('--failfast', action='store_true', default=False, dest='failfast')

    (options, args) = parser.parse_args()

    runtests(failfast=options.failfast, *args)
import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'

from django.test.utils import get_runner
from django.conf import settings
import django

if django.VERSION >= (1, 7):
    django.setup()


def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))


if __name__ == '__main__':
    runtests()

Make test runner only run basis tests
Make test runner only run basis tests

and not dependecies tests

+ import os
  import sys
- from optparse import OptionParser
- from os.path import abspath, dirname
- from django.test.simple import DjangoTestSuiteRunner
+ 
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
+ 
+ from django.test.utils import get_runner
+ from django.conf import settings
+ import django
+ 
+ if django.VERSION >= (1, 7):
+     django.setup()
  
  
+ def runtests():
+     TestRunner = get_runner(settings)
+     test_runner = TestRunner(verbosity=1, interactive=True)
- def runtests(*test_args, **kwargs):
-     parent = dirname(abspath(__file__))
-     sys.path.insert(0, parent)
-     test_runner = DjangoTestSuiteRunner(
-         verbosity=kwargs.get('verbosity', 1),
-         interactive=kwargs.get('interactive', False),
-         failfast=kwargs.get('failfast')
-     )
-     failures = test_runner.run_tests(test_args)
+     failures = test_runner.run_tests(['tests'])
-     sys.exit(failures)
+     sys.exit(bool(failures))
+ 
  
  if __name__ == '__main__':
+     runtests()
-     parser = OptionParser()
-     parser.add_option('--failfast', action='store_true', default=False, dest='failfast')
  
-     (options, args) = parser.parse_args()
- 
-     runtests(failfast=options.failfast, *args)
Make test runner only run basis tests
## Code Before:
import sys
from optparse import OptionParser
from os.path import abspath, dirname
from django.test.simple import DjangoTestSuiteRunner


def runtests(*test_args, **kwargs):
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    test_runner = DjangoTestSuiteRunner(
        verbosity=kwargs.get('verbosity', 1),
        interactive=kwargs.get('interactive', False),
        failfast=kwargs.get('failfast')
    )
    failures = test_runner.run_tests(test_args)
    sys.exit(failures)

if __name__ == '__main__':
    parser = OptionParser()
    parser.add_option('--failfast', action='store_true', default=False, dest='failfast')

    (options, args) = parser.parse_args()

    runtests(failfast=options.failfast, *args)
## Instruction:
Make test runner only run basis tests
## Code After:
import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'

from django.test.utils import get_runner
from django.conf import settings
import django

if django.VERSION >= (1, 7):
    django.setup()


def runtests():
    TestRunner = get_runner(settings)
    test_runner = TestRunner(verbosity=1, interactive=True)
    failures = test_runner.run_tests(['tests'])
    sys.exit(bool(failures))


if __name__ == '__main__':
    runtests()
