~jfb-tempo-consulting/unifield-wm/sync-env-py3

« back to all changes in this revision

Viewing changes to unittest27/test/__init__.py

  • Committer: Samus CTO
  • Date: 2012-09-05 10:40:27 UTC
  • Revision ID: cto@openerp.com-20120905104027-geoynct7122bnoig
[IMPORT] imported unittest from Python 2.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
import sys
 
3
import unittest
 
4
 
 
5
 
 
6
here = os.path.dirname(__file__)
 
7
loader = unittest.defaultTestLoader
 
8
 
 
9
def suite():
 
10
    suite = unittest.TestSuite()
 
11
    for fn in os.listdir(here):
 
12
        if fn.startswith("test") and fn.endswith(".py"):
 
13
            modname = "unittest.test." + fn[:-3]
 
14
            __import__(modname)
 
15
            module = sys.modules[modname]
 
16
            suite.addTest(loader.loadTestsFromModule(module))
 
17
    return suite
 
18
 
 
19
 
 
20
if __name__ == "__main__":
 
21
    unittest.main(defaultTest="suite")