-1

There are lots of answers for test discovery in python 2.7+ but I need one for python 2.6.6.

I've got such directory structure:

root
|-- runall.py
|-- src
|   |-- a.py
|   |-- b.py
|-- test
    |-- atest.py
    |-- btest.py

I would like to load all tests from test in runall.py and run them with unittest.main(). How can I achieve that in python 2.6.6 (without installing additional modules!) in most elegant way ?

Scony
  • 4,068
  • 1
  • 16
  • 23

1 Answers1

0

I think this is a duplicate from: Python: How to run unittest.main() for all source files in a subdirectory?

You should try using nosetests: https://nose.readthedocs.org/en/latest/ It is a pretty easy module for running all your tests. We use it a lot at work:

Here is the answer from the other post, kind of hackish, but appears to work.

dirFoo\
    test.py
    dirBar\
        Foo.py
        Bar.py

Contents of dirFoo/test.py

from dirBar import *
import unittest

if __name__ == "__main__":

    unittest.main()
Community
  • 1
  • 1
Brian Pendleton
  • 839
  • 4
  • 13
  • Not working: `Ran 0 tests in 0.000s`. Also, I can't install any modules + I don't want to. – Scony Sep 02 '15 at 15:28