diff --git a/src/lxml/tests/test_threading.py b/src/lxml/tests/test_threading.py
index 8948c3ec6..5ede3f805 100644
--- a/src/lxml/tests/test_threading.py
+++ b/src/lxml/tests/test_threading.py
@@ -130,7 +130,7 @@ def test_thread_xslt_parsing_error_log(self):
<xsl:template match="tag" />
<!-- extend time for parsing + transform -->
''' + '\n'.join('<xsl:template match="tag%x" />' % i for i in range(200)) + '''
- <xsl:foo />
+ <xsl:UnExpectedElement />
</xsl:stylesheet>''')
self.assertRaises(etree.XSLTParseError,
etree.XSLT, style)
@@ -153,9 +153,10 @@ def run_thread():
self.assertTrue(len(log))
if last_log is not None:
self.assertEqual(len(last_log), len(log))
- self.assertEqual(4, len(log))
+ self.assertTrue(len(log) >= 2, len(log))
for error in log:
- self.assertTrue(':ERROR:XSLT:' in str(error))
+ self.assertTrue(':ERROR:XSLT:' in str(error), str(error))
+ self.assertTrue(any('UnExpectedElement' in str(error) for error in log), log)
last_log = log
def test_thread_xslt_apply_error_log(self):