Mercurial > p > roundup > code
comparison test/test_misc.py @ 6985:fb7056f2dcda
normalize out python version and path.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 14 Sep 2022 23:02:08 -0400 |
| parents | 83720f0aee06 |
| children | 51f9bd50f875 |
comparison
equal
deleted
inserted
replaced
| 6984:83720f0aee06 | 6985:fb7056f2dcda |
|---|---|
| 155 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | 155 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| 156 <tr bgcolor="#777777"> | 156 <tr bgcolor="#777777"> |
| 157 <td valign=bottom> <br> | 157 <td valign=bottom> <br> |
| 158 <font color="#ffffff" face="helvetica, arial"> <br><font size=+1><strong>NameError</strong>: global name 'a' is not defined</font></font></td | 158 <font color="#ffffff" face="helvetica, arial"> <br><font size=+1><strong>NameError</strong>: global name 'a' is not defined</font></font></td |
| 159 ><td align=right valign=bottom | 159 ><td align=right valign=bottom |
| 160 ><font color="#ffffff" face="helvetica, arial">Python 2.7.17<br>/usr/bin/python2</font></td></tr></table> | 160 ><font color="#ffffff" face="helvetica, arial">Python XX</font></td></tr></table> |
| 161 <p>A problem occurred while running a Python script. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call first. The exception attributes are:<br><tt><small> </small> </tt>__class__ = <type 'exceptions.NameError'> <br><tt><small> </small> </tt>__delattr__ = <method-wrapper '__delattr__' of exceptions.NameError object> <br><tt><small> </small> </tt>__dict__ = {} <br><tt><small> </small> </tt>__doc__ = 'Name not found globally.' <br><tt><small> </small> </tt>__format__ = <built-in method __format__ of exceptions.NameError object> <br><tt><small> </small> </tt>__getattribute__ = <method-wrapper '__getattribute__' of exceptions.NameError object> <br><tt><small> </small> </tt>__getitem__ = <method-wrapper '__getitem__' of exceptions.NameError object> <br><tt><small> </small> </tt>__getslice__ = <method-wrapper '__getslice__' of exceptions.NameError object> <br><tt><small> </small> </tt>__hash__ = <method-wrapper '__hash__' of exceptions.NameError object> <br><tt><small> </small> </tt>__init__ = <method-wrapper '__init__' of exceptions.NameError object> <br><tt><small> </small> </tt>__new__ = <built-in method __new__ of type object> <br><tt><small> </small> </tt>__reduce__ = <built-in method __reduce__ of exceptions.NameError object> <br><tt><small> </small> </tt>__reduce_ex__ = <built-in method __reduce_ex__ of exceptions.NameError object> <br><tt><small> </small> </tt>__repr__ = <method-wrapper '__repr__' of exceptions.NameError object> <br><tt><small> </small> </tt>__setattr__ = <method-wrapper '__setattr__' of exceptions.NameError object> <br><tt><small> </small> </tt>__setstate__ = <built-in method __setstate__ of exceptions.NameError object> <br><tt><small> </small> </tt>__sizeof__ = <built-in method __sizeof__ of exceptions.NameError object> <br><tt><small> </small> </tt>__str__ = <method-wrapper '__str__' of exceptions.NameError object> <br><tt><small> </small> </tt>__subclasshook__ = <built-in method __subclasshook__ of type object> <br><tt><small> </small> </tt>__unicode__ = <built-in method __unicode__ of exceptions.NameError object> <br><tt><small> </small> </tt>args = ("global name 'a' is not defined",) <br><tt><small> </small> </tt>message = "global name 'a' is not defined"<p> | 161 <p>A problem occurred while running a Python script. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call first. The exception attributes are:<br><tt><small> </small> </tt>__class__ = <type 'exceptions.NameError'> <br><tt><small> </small> </tt>__delattr__ = <method-wrapper '__delattr__' of exceptions.NameError object> <br><tt><small> </small> </tt>__dict__ = {} <br><tt><small> </small> </tt>__doc__ = 'Name not found globally.' <br><tt><small> </small> </tt>__format__ = <built-in method __format__ of exceptions.NameError object> <br><tt><small> </small> </tt>__getattribute__ = <method-wrapper '__getattribute__' of exceptions.NameError object> <br><tt><small> </small> </tt>__getitem__ = <method-wrapper '__getitem__' of exceptions.NameError object> <br><tt><small> </small> </tt>__getslice__ = <method-wrapper '__getslice__' of exceptions.NameError object> <br><tt><small> </small> </tt>__hash__ = <method-wrapper '__hash__' of exceptions.NameError object> <br><tt><small> </small> </tt>__init__ = <method-wrapper '__init__' of exceptions.NameError object> <br><tt><small> </small> </tt>__new__ = <built-in method __new__ of type object> <br><tt><small> </small> </tt>__reduce__ = <built-in method __reduce__ of exceptions.NameError object> <br><tt><small> </small> </tt>__reduce_ex__ = <built-in method __reduce_ex__ of exceptions.NameError object> <br><tt><small> </small> </tt>__repr__ = <method-wrapper '__repr__' of exceptions.NameError object> <br><tt><small> </small> </tt>__setattr__ = <method-wrapper '__setattr__' of exceptions.NameError object> <br><tt><small> </small> </tt>__setstate__ = <built-in method __setstate__ of exceptions.NameError object> <br><tt><small> </small> </tt>__sizeof__ = <built-in method __sizeof__ of exceptions.NameError object> <br><tt><small> </small> </tt>__str__ = <method-wrapper '__str__' of exceptions.NameError object> <br><tt><small> </small> </tt>__subclasshook__ = <built-in method __subclasshook__ of type object> <br><tt><small> </small> </tt>__unicode__ = <built-in method __unicode__ of exceptions.NameError object> <br><tt><small> </small> </tt>args = ("global name 'a' is not defined",) <br><tt><small> </small> </tt>message = "global name 'a' is not defined"<p> |
| 162 <table width="100%" bgcolor="#dddddd" cellspacing=0 cellpadding=2 border=0> | 162 <table width="100%" bgcolor="#dddddd" cellspacing=0 cellpadding=2 border=0> |
| 163 <tr><td><a href="file:XX/test/test_misc.py">XX/test/test_misc.py</a> in <strong>test_html</strong>(self=<test.test_misc.CgiTbCheck testMethod=test_html>)</td></tr></table> | 163 <tr><td><a href="file:XX/test/test_misc.py">XX/test/test_misc.py</a> in <strong>test_html</strong>(self=<test.test_misc.CgiTbCheck testMethod=test_html>)</td></tr></table> |
| 164 <tt><small><font color="#909090"> XX</font></small> f = 5<br> | 164 <tt><small><font color="#909090"> XX</font></small> f = 5<br> |
| 165 </tt> | 165 </tt> |
| 168 <table width="100%" bgcolor="white" cellspacing=0 cellpadding=0 border=0> | 168 <table width="100%" bgcolor="white" cellspacing=0 cellpadding=0 border=0> |
| 169 <tr><td><tt><small><font color="#909090"> XX</font></small> d = a + 4<br> | 169 <tr><td><tt><small><font color="#909090"> XX</font></small> d = a + 4<br> |
| 170 </tt></td></tr></table> | 170 </tt></td></tr></table> |
| 171 <tt><small> </small> </tt><small><font color="#909090"><strong>d</strong> = <em>undefined</em>, <em>global</em> <strong>a</strong> = <em>undefined</em></font></small><br><p> </p>""" | 171 <tt><small> </small> </tt><small><font color="#909090"><strong>d</strong> = <em>undefined</em>, <em>global</em> <strong>a</strong> = <em>undefined</em></font></small><br><p> </p>""" |
| 172 | 172 |
| 173 expected3 = """\n<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">\n<tr bgcolor="#777777">\n<td valign=bottom> <br>\n<font color="#ffffff" face="helvetica, arial"> <br><font size=+1><strong>NameError</strong>: name \'a\' is not defined</font></font></td\n><td align=right valign=bottom\n><font color="#ffffff" face="helvetica, arial">Python 3.6.9<br>/usr/bin/python3</font></td></tr></table>\n <p>A problem occurred while running a Python script. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call first. The exception attributes are:<br><tt><small> </small> </tt>__cause__ = None <br><tt><small> </small> </tt>__class__ = <class \'NameError\'> <br><tt><small> </small> </tt>__context__ = None <br><tt><small> </small> </tt>__delattr__ = <method-wrapper \'__delattr__\' of NameError object> <br><tt><small> </small> </tt>__dict__ = {} <br><tt><small> </small> </tt>__dir__ = <built-in method __dir__ of NameError object> <br><tt><small> </small> </tt>__doc__ = \'Name not found globally.\' <br><tt><small> </small> </tt>__eq__ = <method-wrapper \'__eq__\' of NameError object> <br><tt><small> </small> </tt>__format__ = <built-in method __format__ of NameError object> <br><tt><small> </small> </tt>__ge__ = <method-wrapper \'__ge__\' of NameError object> <br><tt><small> </small> </tt>__getattribute__ = <method-wrapper \'__getattribute__\' of NameError object> <br><tt><small> </small> </tt>__gt__ = <method-wrapper \'__gt__\' of NameError object> <br><tt><small> </small> </tt>__hash__ = <method-wrapper \'__hash__\' of NameError object> <br><tt><small> </small> </tt>__init__ = <method-wrapper \'__init__\' of NameError object> <br><tt><small> </small> </tt>__init_subclass__ = <built-in method __init_subclass__ of type object> <br><tt><small> </small> </tt>__le__ = <method-wrapper \'__le__\' of NameError object> <br><tt><small> </small> </tt>__lt__ = <method-wrapper \'__lt__\' of NameError object> <br><tt><small> </small> </tt>__ne__ = <method-wrapper \'__ne__\' of NameError object> <br><tt><small> </small> </tt>__new__ = <built-in method __new__ of type object> <br><tt><small> </small> </tt>__reduce__ = <built-in method __reduce__ of NameError object> <br><tt><small> </small> </tt>__reduce_ex__ = <built-in method __reduce_ex__ of NameError object> <br><tt><small> </small> </tt>__repr__ = <method-wrapper \'__repr__\' of NameError object> <br><tt><small> </small> </tt>__setattr__ = <method-wrapper \'__setattr__\' of NameError object> <br><tt><small> </small> </tt>__setstate__ = <built-in method __setstate__ of NameError object> <br><tt><small> </small> </tt>__sizeof__ = <built-in method __sizeof__ of NameError object> <br><tt><small> </small> </tt>__str__ = <method-wrapper \'__str__\' of NameError object> <br><tt><small> </small> </tt>__subclasshook__ = <built-in method __subclasshook__ of type object> <br><tt><small> </small> </tt>__suppress_context__ = False <br><tt><small> </small> </tt>__traceback__ = <traceback object> <br><tt><small> </small> </tt>args = ("name \'a\' is not defined",) <br><tt><small> </small> </tt>with_traceback = <built-in method with_traceback of NameError object><p>\n<table width="100%" bgcolor="#dddddd" cellspacing=0 cellpadding=2 border=0>\n<tr><td><a href="file:XX/test/test_misc.py">XX/test/test_misc.py</a> in <strong>test_html</strong>(self=<test.test_misc.CgiTbCheck testMethod=test_html>)</td></tr></table>\n<tt><small><font color="#909090"> XX</font></small> f = 5<br>\n</tt>\n\n\n<table width="100%" bgcolor="white" cellspacing=0 cellpadding=0 border=0>\n<tr><td><tt><small><font color="#909090"> XX</font></small> d = a + 4<br>\n</tt></td></tr></table>\n<tt><small> </small> </tt><small><font color="#909090"><strong>d</strong> = <em>undefined</em>, <em>global</em> <strong>a</strong> = <em>undefined</em></font></small><br><p> </p>""" | 173 expected3 = """\n<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">\n<tr bgcolor="#777777">\n<td valign=bottom> <br>\n<font color="#ffffff" face="helvetica, arial"> <br><font size=+1><strong>NameError</strong>: name \'a\' is not defined</font></font></td\n><td align=right valign=bottom\n><font color="#ffffff" face="helvetica, arial">Python XX</font></td></tr></table>\n <p>A problem occurred while running a Python script. Here is the sequence of function calls leading up to the error, with the most recent (innermost) call first. The exception attributes are:<br><tt><small> </small> </tt>__cause__ = None <br><tt><small> </small> </tt>__class__ = <class \'NameError\'> <br><tt><small> </small> </tt>__context__ = None <br><tt><small> </small> </tt>__delattr__ = <method-wrapper \'__delattr__\' of NameError object> <br><tt><small> </small> </tt>__dict__ = {} <br><tt><small> </small> </tt>__dir__ = <built-in method __dir__ of NameError object> <br><tt><small> </small> </tt>__doc__ = \'Name not found globally.\' <br><tt><small> </small> </tt>__eq__ = <method-wrapper \'__eq__\' of NameError object> <br><tt><small> </small> </tt>__format__ = <built-in method __format__ of NameError object> <br><tt><small> </small> </tt>__ge__ = <method-wrapper \'__ge__\' of NameError object> <br><tt><small> </small> </tt>__getattribute__ = <method-wrapper \'__getattribute__\' of NameError object> <br><tt><small> </small> </tt>__gt__ = <method-wrapper \'__gt__\' of NameError object> <br><tt><small> </small> </tt>__hash__ = <method-wrapper \'__hash__\' of NameError object> <br><tt><small> </small> </tt>__init__ = <method-wrapper \'__init__\' of NameError object> <br><tt><small> </small> </tt>__init_subclass__ = <built-in method __init_subclass__ of type object> <br><tt><small> </small> </tt>__le__ = <method-wrapper \'__le__\' of NameError object> <br><tt><small> </small> </tt>__lt__ = <method-wrapper \'__lt__\' of NameError object> <br><tt><small> </small> </tt>__ne__ = <method-wrapper \'__ne__\' of NameError object> <br><tt><small> </small> </tt>__new__ = <built-in method __new__ of type object> <br><tt><small> </small> </tt>__reduce__ = <built-in method __reduce__ of NameError object> <br><tt><small> </small> </tt>__reduce_ex__ = <built-in method __reduce_ex__ of NameError object> <br><tt><small> </small> </tt>__repr__ = <method-wrapper \'__repr__\' of NameError object> <br><tt><small> </small> </tt>__setattr__ = <method-wrapper \'__setattr__\' of NameError object> <br><tt><small> </small> </tt>__setstate__ = <built-in method __setstate__ of NameError object> <br><tt><small> </small> </tt>__sizeof__ = <built-in method __sizeof__ of NameError object> <br><tt><small> </small> </tt>__str__ = <method-wrapper \'__str__\' of NameError object> <br><tt><small> </small> </tt>__subclasshook__ = <built-in method __subclasshook__ of type object> <br><tt><small> </small> </tt>__suppress_context__ = False <br><tt><small> </small> </tt>__traceback__ = <traceback object> <br><tt><small> </small> </tt>args = ("name \'a\' is not defined",) <br><tt><small> </small> </tt>with_traceback = <built-in method with_traceback of NameError object><p>\n<table width="100%" bgcolor="#dddddd" cellspacing=0 cellpadding=2 border=0>\n<tr><td><a href="file:XX/test/test_misc.py">XX/test/test_misc.py</a> in <strong>test_html</strong>(self=<test.test_misc.CgiTbCheck testMethod=test_html>)</td></tr></table>\n<tt><small><font color="#909090"> XX</font></small> f = 5<br>\n</tt>\n\n\n<table width="100%" bgcolor="white" cellspacing=0 cellpadding=0 border=0>\n<tr><td><tt><small><font color="#909090"> XX</font></small> d = a + 4<br>\n</tt></td></tr></table>\n<tt><small> </small> </tt><small><font color="#909090"><strong>d</strong> = <em>undefined</em>, <em>global</em> <strong>a</strong> = <em>undefined</em></font></small><br><p> </p>""" |
| 174 | 174 |
| 175 # strip file path prefix from href and text | 175 # strip file path prefix from href and text |
| 176 # /home/user/develop/roundup/test/test_misc.py in test_html | 176 # /home/user/develop/roundup/test/test_misc.py in test_html |
| 177 h = re.sub(r'(file:)/.*/(test/test_misc.py")', r'\1XX/\2', h) | 177 h = re.sub(r'(file:)/.*/(test/test_misc.py")', r'\1XX/\2', h) |
| 178 h = re.sub(r'(/test_misc.py">)/.*/(test/test_misc.py</a>)', | 178 h = re.sub(r'(/test_misc.py">)/.*/(test/test_misc.py</a>)', |
| 179 r'\1XX/\2', h) | 179 r'\1XX/\2', h) |
| 180 # replace code line numbers with XX | 180 # replace code line numbers with XX |
| 181 h = re.sub(r'( )\d*(</font>)', r'\1XX\2', h) | 181 h = re.sub(r'( )\d*(</font>)', r'\1XX\2', h) |
| 182 # normalize out python version/path | |
| 183 h = re.sub(r'(Python )[\d.]*<br>[^<]*(</font><)', r'\1XX\2', h) | |
| 182 | 184 |
| 183 print(h) | 185 print(h) |
| 184 | 186 |
| 185 if sys.version_info > (3, 0, 0): | 187 if sys.version_info > (3, 0, 0): |
| 186 import pdb; pdb.set_trace() | |
| 187 self.assertEqual(expected3, h) | 188 self.assertEqual(expected3, h) |
| 188 else: | 189 else: |
| 189 self.assertEqual(expected2, h) | 190 self.assertEqual(expected2, h) |
