Merge lp:~javier.collado/mago/unittest-trick into lp:mago
Status: | Merged |
---|---|
Merged at revision: | 23 |
Proposed branch: | lp:~javier.collado/mago/unittest-trick |
Merge into: | lp:mago |
Diff against target: |
46 lines (+15/-11) 2 files modified
mago/__init__.py (+14/-0) mago/case.py (+1/-11) |
To merge this branch: | bzr merge lp:~javier.collado/mago/unittest-trick |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Tatum | Approve | ||
Review via email:
|
Description of the change
Right no the mago.case module checks the python interpreter version and imports unittest2 as unittest when it's lower than 2.7.
While this solution works well for this module, there are other modules that might use unittest (mago.core does) and also all test cases (for example, the ones in lp:~mago-contributors/mago/mago-testsuite).
Since it would be too verbose to add the same kind of check to every module and test that needs unittest, this branch takes another approach. It does the check the first thing when mago module is imported and then sets sys.modules[
That's clever!