@@ -27,7 +27,7 @@ def convertTreeDump(data):
2727
2828def runParserTest (innerHTML ,input ,expected ,errors ,treeClass ,
2929namespaceHTMLElements ):
30- with warnings .catch_warnings (record = True )as w :
30+ with warnings .catch_warnings (record = True )as caughtWarnings :
3131warnings .simplefilter ("always" )
3232p = html5parser .HTMLParser (tree = treeClass ,
3333namespaceHTMLElements = namespaceHTMLElements )
@@ -42,9 +42,10 @@ def runParserTest(innerHTML, input, expected, errors, treeClass,
4242"\n Traceback:" ,traceback .format_exc ()])
4343assert False ,errorMsg
4444
45- otherW = [x for x in w if not issubclass (x .category ,constants .DataLossWarning )]
46- assert len (otherW )== 0 , [(x .category ,x .message )for x in otherW ]
47- if len (w ):
45+ otherWarnings = [x for x in caughtWarnings
46+ if not issubclass (x .category ,constants .DataLossWarning )]
47+ assert len (otherWarnings )== 0 , [(x .category ,x .message )for x in otherWarnings ]
48+ if len (caughtWarnings ):
4849return
4950
5051output = convertTreeDump (p .tree .testSerializer (document ))