Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Returns the number of tests that failed.
"""
# Django setup
self.setup_test_environment()
django_db = self.setup_databases()
# Green
if type(test_labels) == tuple:
test_labels = list(test_labels)
else:
raise ValueError("test_labels should be a tuple of strings")
if not test_labels:
test_labels = ['.']
args = mergeConfig(Namespace())
if self.verbose != -1:
args.verbose = self.verbose
args.targets = test_labels
stream = GreenStream(sys.stdout)
suite = self.loader.loadTargets(args.targets)
if not suite:
suite = GreenTestSuite()
result = run(suite, stream, args)
# Django teardown
self.teardown_databases(django_db)
self.teardown_test_environment()
return self.suite_result(suite, result)