From 3d69db8469a8049e0ea75bcca961af61d5cd1d8b Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Tue, 12 Feb 2013 15:04:30 -0500 Subject: [PATCH] tests: Fail with a useful error message if Pygments is missing (imported from commit 9c0eba6b5629a28c6171ec316038120acaa3ea44) --- zephyr/tests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zephyr/tests.py b/zephyr/tests.py index 99ab98a8b7..d48c5b33e0 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -21,13 +21,19 @@ import re import sys import random +def bail(msg): + print '\nERROR: %s\n' % (msg,) + sys.exit(1) + try: settings.TEST_SUITE except: - print - print "ERROR: Test suite only runs correctly with --settings=humbug.test_settings" - print - sys.exit(1) + bail('Test suite only runs correctly with --settings=humbug.test_settings') + +try: + import pygments +except ImportError: + bail('The Pygments library is required to run the backend test suite.') def find_key_by_email(address): from django.core.mail import outbox