~nimit-svnit/gtg/bug-1102453

« back to all changes in this revision

Viewing changes to GTG/tests/__init__.py

  • Committer: Izidor Matušov
  • Date: 2013-02-25 07:35:07 UTC
  • Revision ID: izidor.matusov@gmail.com-20130225073507-vgts69uthx7z2run
PEP8ification by Nimit

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    Automatically loads all the tests in the GTG/tests directory and returns a
32
32
    unittest.TestSuite filled with them
33
33
    '''
34
 
    #find all the test files
 
34
    # find all the test files
35
35
    test_dir = os.path.dirname(__file__)
36
36
    test_files = filter(lambda f: f.endswith(".py") and f.startswith("test_"),
37
37
                        os.listdir(test_dir))
38
38
 
39
 
 
40
 
    #Loading of the test files and adding to the TestSuite
 
39
    # Loading of the test files and adding to the TestSuite
41
40
    test_suite = unittest.TestSuite()
42
41
    for module_name in [f[:-3] for f in test_files]:
43
 
            #module loading
 
42
            # module loading
44
43
            module_path = TEST_MODULE_PREFIX + module_name
45
44
            module = __import__(module_path)
46
45
            sys.modules[module_path] = module
47
46
            globals()[module_path] = module
48
 
            #fetching the testsuite
 
47
            # fetching the testsuite
49
48
 
50
49
            # Crude hack to satisfy both GIT repository and GTG trunk
51
50
            if TEST_MODULE_PREFIX == "GTG.tests.":
54
53
                tests = module
55
54
 
56
55
            a_test = getattr(tests, module_name)
57
 
            #adding it to the unittest.TestSuite
 
56
            # adding it to the unittest.TestSuite
58
57
            test_suite.addTest(getattr(a_test, "test_suite")())
59
58
 
60
59
    return test_suite