I currently work on some code that uses unittest2 module. I suspect this code was meant for the python2. Can one use python3 unittest as a drop in replacement for unittest2? What is the difference between the two?
Asked
Active
Viewed 9,011 times
1 Answers
23
According to the Python 2.7 unittest docs:
unittest2: A backport of new unittest features for Python 2.4-2.6 Many new features were added to unittest in Python 2.7, including test discovery. unittest2 allows you to use these features with earlier versions of Python.
So moving from unittest2
under Python 2 to unittest
under Python 2.7 or Python 3 should do exactly what you want

rbp
- 1,850
- 15
- 28
-
5`unittest2` seems also to support some advanced function not supported by `unittest`. For example, `subTest` which is supported from `Python3.4`. – SangminKim Dec 13 '17 at 17:16