Skip to content Skip to sidebar Skip to footer

Run Python Unit Test With Python 2.7 And 3.x

I run my python unit tests by executing my test file through the shell and invoking if __name__ == '__main__': unittest.main() at the end of the test file. I have to support p

Solution 1:

The standard tools for this problem are six, to help you write a script that will run equally well under python2 and python3, and tox, to help you run your test suite on several python versions. Once you have your script working and tested, and tox configured, you just run tox to run your test suite under your various pythons.

Solution 2:

There are presentation slides about running code on both 2.x and 3.x, at http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/

I've never used Sublime, so I can't help you with that part.

Post a Comment for "Run Python Unit Test With Python 2.7 And 3.x"