summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Vandenberg <jayvdb@gmail.com>2016-09-20 07:16:04 +0700
committerJohn Vandenberg <jayvdb@gmail.com>2016-09-20 07:16:04 +0700
commit0159ddee602ece9075fc48aa019d0c4fa298e454 (patch)
tree6427663427026902233e6d2776c45bb2c1ed456a
parent56e75b33d66738b072f9f5525f3af4a8ba863d8b (diff)
downloadpygments-0159ddee602ece9075fc48aa019d0c4fa298e454.tar.gz
Provide explanation when a test is skipped
SkipTest messages are shown when running the test suite with verbosity, such as `nosetests -v`. They help the user see how to fix the problem, in order to achieve higher coverage when running the test suite.
-rw-r--r--tests/test_basic_api.py8
-rw-r--r--tests/test_examplefiles.py2
-rw-r--r--tests/test_latex_formatter.py4
3 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py
index 022e6c55..03a452d7 100644
--- a/tests/test_basic_api.py
+++ b/tests/test_basic_api.py
@@ -161,8 +161,8 @@ def test_formatter_public_api():
try:
inst = formatter(opt1="val1")
- except (ImportError, FontNotFound):
- raise support.SkipTest
+ except (ImportError, FontNotFound) as e:
+ raise support.SkipTest(e)
try:
inst.get_style_defs()
@@ -209,9 +209,9 @@ def test_formatter_unicode_handling():
def verify(formatter):
try:
inst = formatter(encoding=None)
- except (ImportError, FontNotFound):
+ except (ImportError, FontNotFound) as e:
# some dependency or font not installed
- raise support.SkipTest
+ raise support.SkipTest(e)
if formatter.name != 'Raw tokens':
out = format(tokens, inst)
diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py
index f43abf9b..28037a55 100644
--- a/tests/test_examplefiles.py
+++ b/tests/test_examplefiles.py
@@ -89,7 +89,7 @@ def test_example_files():
def check_lexer(lx, fn):
if os.name == 'java' and fn in BAD_FILES_FOR_JYTHON:
- raise support.SkipTest
+ raise support.SkipTest('%s is a known bad file on Jython' % fn)
absfn = os.path.join(TESTDIR, 'examplefiles', fn)
with open(absfn, 'rb') as fp:
text = fp.read()
diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py
index 05a6c3ac..fbcb6cde 100644
--- a/tests/test_latex_formatter.py
+++ b/tests/test_latex_formatter.py
@@ -42,9 +42,9 @@ class LatexFormatterTest(unittest.TestCase):
ret = po.wait()
output = po.stdout.read()
po.stdout.close()
- except OSError:
+ except OSError as e:
# latex not available
- raise support.SkipTest
+ raise support.SkipTest(e)
else:
if ret:
print(output)