1

Similar to Force Nosetests to Use Python 2.7 instead of 3.4, I've written some unit tests in Python 2 which I'd like to run in Python 2. However, by default my installation of nose2 seems to try to run Python 3.

For example, if I try to run unittest_controller.py I get output ending with

Ran 4 tests in 1.552s

OK

whereas if I use the command nose2 from the same directory, I get

ImportError: No module named 'StringIO'


----------------------------------------------------------------------
Ran 2 tests in 0.001s

FAILED (errors=2)

because StringIO is no longer a module in Python 3. How can I run the tests using Python 2?

Community
  • 1
  • 1
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526

0 Answers0