Skip to content

Commit 1082b8c

Browse files
committed
Skip distutils.log test if distutils.log is not available.
1 parent 14cbbc3 commit 1082b8c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

unit_tests/test_xunit.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,18 @@ def test_tee_has_error_and_encoding_attributes(self):
8181
self.assertTrue(hasattr(tee, 'errors'))
8282

8383
def test_tee_works_with_distutils_log(self):
84-
from distutils.log import Log, DEBUG
84+
try:
85+
from distutils.log import Log, DEBUG
86+
except ImportError:
87+
raise SkipTest("distutils.log not available; skipping")
88+
8589
l = Log(DEBUG)
86-
l.warn('Test')
90+
try:
91+
l.warn('Test')
92+
except Exception, e:
93+
self.fail(
94+
"Exception raised while writing to distutils.log: %s" % (e,))
95+
8796

8897
class TestXMLOutputWithXML(unittest.TestCase):
8998

0 commit comments

Comments
 (0)