()
Prints available tests list, easy to be copied and run.
Prints available tests list, easy to be copied and run.
Prints available tests list easy to be copied and run .
def show_test_names():
    """
    Prints available tests list, easy to be copied and run.
    """
    def _found_tests():
        tests_path = os.path.join(settings.TIPBOARD_PATH, 'tests')
        suite = loader.discover(tests_path, pattern='test*.py')
        for file_tests in suite._tests:
            for class_tests in file_tests._tests:
                for test in class_tests._tests:
                    yield test

    print('Available test names:')
    loader = unittest.TestLoader()
    last_test_file_name, last_test_case_name = '', ''
    for test in _found_tests():
        test_file_name, test_case_name = (
            str(test).split(' ')[1][1:-1].split('.')
        )
        test_name = test._testMethodName
        if last_test_file_name != test_file_name:
            to_print = '  ' + test_file_name
            print(to_print)
            last_test_file_name = test_file_name
        if last_test_case_name != test_case_name:
            to_print = '  {}'.format(
                '.'.join([to_print, test_case_name])
            )
            print(to_print)
            last_test_case_name = test_case_name
        print('  {}'.format('.'.join([to_print, test_name])))
def show_test_names ( ) : def _found_tests ( ) : tests_path = os . path . join ( settings . TIPBOARD_PATH , 'tests' ) suite = loader . discover ( tests_path , pattern = 'test*.py' ) for file_tests in suite . _tests : for class_tests in file_tests . _tests : for test in class_tests . _tests : yield test print ( 'Available test names:' ) loader = unittest . TestLoader ( ) last_test_file_name , last_test_case_name = '' , '' for test in _found_tests ( ) : test_file_name , test_case_name = ( str ( test ) . split ( ' ' ) [ 1 ] [ 1 : - 1 ] . split ( '.' ) ) test_name = test . _testMethodName if last_test_file_name != test_file_name : to_print = '  ' + test_file_name print ( to_print ) last_test_file_name = test_file_name if last_test_case_name != test_case_name : to_print = '  {}' . format ( '.' . join ( [ to_print , test_case_name ] ) ) print ( to_print ) last_test_case_name = test_case_name print ( '  {}' . format ( '.' . join ( [ to_print , test_name ] ) ) )