Example #1
0
def run(args=None):
    # Tests that don't take long to run
    fast_tests = [
        ai_lib_t.suite,
        actor_t.suite,
        vector_t.suite,
        geometry_t.suite,
        # battle_t.suite,
        screen_lib_t.suite,
        object_base_t.suite,
    ]
    
    # Tests that take a while to run
    slow_tests = [
        # App core
        application_t.suite,
        
        # Screens
        screen_t.suite,
        battle_screen_t.suite,
        
        # Sim
        battle_sim_t.suite,
    ]
    
    # Have args been passed?
    if args:
        if args.all:
            suite = unittest.TestSuite(fast_tests + slow_tests)
        else:
            suite = unittest.TestSuite(fast_tests)
        
        if args.verbose == True:
            verbosity = 2
        else:
            verbosity = 1
    else:
        # No args, probably an initial test
        suite = unittest.TestSuite(fast_tests)
        verbosity = 1
    
    test_result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
    
    # Covers currently doesn't work correctly
    return
    if test_result.failures == [] and test_result.errors == []:
        module_skip = ["main"]
        dirs_skip = ['test_lib', 'media', 'screenshots']
        
        if True or args.v:
            output_mode = "print"
        else:
            output_mode = "summary"
        
        covers.get_coverage(suite,
            verbose=args.verbose,
            module_skip = module_skip,
            dirs_skip = dirs_skip,
            output_mode=output_mode)
Example #2
0
def main():
    test_program = unittest.main(exit=False)

    if test_program.result.failures == [] and test_program.result.errors == []:
        verbose = False
        if len(sys.argv) > 1:
            verbose = True

        module_skip = [
            "bpgsql3",
            "cli",
            "db_convert",
            "exec",
            "rob_server",
            "sync",
            "tests",
            "web",
            "web (for server)",
            "world_test",
            "world",
            "spy_world",
            "ploc",
            "cli_f",
        ]
        dirs_skip = [
            "backup",
            "cache",
            "covers",
            "includes",
            "lists",
            "misc",
            "msn",
            "msn_old",
            "profile_library",
            "script_output",
            "test_library",
            "pages",
            "lore",
        ]

        covers.get_coverage(test_program, common.data["server_fpath"], verbose, module_skip, dirs_skip)