示例#1
0
	def handle(self, *probe_labels, **options):
		from django.conf import settings
		from django_probe.utils import get_probe_runner
		
		verbosity = int(options.get('verbosity', 1))
		interactive = options.get('interactive', True)
		failfast = options.get('failfast', False)
		ProbeRunner = get_probe_runner(settings)
		
		probe_runner = ProbeRunner(verbosity=verbosity, interactive=interactive, failfast=failfast)
		(suite, failures, errors) = probe_runner.run_probes(probe_labels)

		if failures or errors:
			sys.exit(bool(failures))
示例#2
0
def probe(request):

	# Empty for now. We should be able to set this from the request parameters
	probe_labels = []
	
	ProbeRunner = get_probe_runner(settings)
	probe_output = StringIO.StringIO()
	probe_runner = ProbeRunner(verbosity=2, interactive=False, failfast=False)
	(probe_suite, failures, errors) = probe_runner.run_probes(probe_labels, stream = probe_output)
	
	context = {
		"probe_suite": probe_suite,
		"failures": failures,
		"errors": errors,
		"probe_output": probe_output.getvalue(),
	}
	
	probe_output.close()

	return render_to_response('probe.html', context, RequestContext(request))