| Dalba claimed this task. Dalba added a comment. |
python2.6 passes exception arguments to a context manager differently. Here is an example script:
i = iter([])
class PrintExitArgs: def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): print(exc_type, exc_value, traceback) return True with PrintExitArgs(): next(i)
here are the results of running this script on python2.6 and 2.7:
$ python2.6 myscript.py (<type 'exceptions.StopIteration'>, None, <traceback object at 0x7fa9349a9830>) $ python2.7 myscript.py (<type 'exceptions.StopIteration'>, StopIteration(), <traceback object at 0x7f38f0ab3998>)
The _AssertRaisesContext in unittest2 has the same issue. The exc_value it receives is None.
I did not find their official bug tracker to report the issue.
AFAIS we can't use assertRaisesRegex in this particular case until the issue is resolved in the unittest2. Until then I'm going to propose a change to use assertRaises instead.
TASK DETAIL
EMAIL PREFERENCES
To: Dalba
Cc: Dalba, Phantom42, pywikibot-bugs-list, Aklapper, jayvdb, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, Sn1per, Masti, Alchimista, Rxy
Cc: Dalba, Phantom42, pywikibot-bugs-list, Aklapper, jayvdb, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, Sn1per, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
