Beispiel #1
0
def custom_name_func(testcase_func, param_num, param):
    """
  A custom test name function that will ensure that the tests are run such that they're batched with all tests for a
  given data set are run together, avoiding re-reading the data more than necessary. Tests are run in alphabetical
  order, so put the test case first. An alternate option is to right justify the test number (param_num) with zeroes
  so that the numerical and alphabetical orders are the same. Not providing this method when there are more than 10
  tests results in tests running in an order similar to:

  test_*.test_scenario_0_*

  test_*.test_scenario_10_*

  test_*.test_scenario_11_*

  ...

  test_*.test_scenario_19_*

  test_*.test_scenario_1_*

  test_*.test_scenario_20_*
  """
    global logger

    logger.debug(
        'custom_name_func: function name = %s, param_num = {0:0>3}, param.args = %s'
        .format(param_num), testcase_func.__name__, param.args)
    return str("%s_%s" % (
        testcase_func.__name__,
        parameterized.to_safe_name("_".join(str(x) for x in param.args)),
    ))
def test_case_name(testcase_func, param_num, param):
  """:mod:`nose_parameterized` callback function to create custom 
  test function names.

  This overrides the default method names created by
  :mod:`nose_parameterized`.

  :param testcase_func: test function
  :type testcase_func: function
  :param param_num: number of parameters in `param`
  :type param_num: int
  :param param: tuple of arguments to test function
  :type param: tuple of form (int, str or unicode, _, str or unicode,
    _) 
  :return: test function name of form ``N_EXTIN_EXTOUT`` (e.g. 
    ``test_case_1_provx_json``)
  :rtype: str or unicode
  """
  (index, ext_in, _, ext_out, _) =  param.args
  return str("%s_%s" %(
    testcase_func.__name__,
    parameterized.to_safe_name(str(index) + "_" + ext_in + "_" + ext_out)))
Beispiel #3
0
def custom_name_func(testcase_func, param_num, param):
    return "%s_%s" % (
        testcase_func.__name__,
        parameterized.to_safe_name("_".join(str(x) for x in param.args)),
    )
def even_case_name(testcase_func, param_num, param):
  (value,) =  param.args
  return parameterized.to_safe_name(str(testcase_func.__name__ + "_custom_" + str(value)))
Beispiel #5
0
def custom_name_func(testcase_func, param_num, param):
    return "%s_%s" % (
        testcase_func.__name__,
        parameterized.to_safe_name("_".join(str(x) for x in param.args)),
    )
def noseParameterisedTestNameGenerator(testcase_func, param_num, param):
    return "%s_%s" % (testcase_func.__name__, parameterized.to_safe_name(str(param.args[0])))
Beispiel #7
0
def noseParameterisedTestNameGenerator(testcase_func, param_num, param):
    return "%s_%s" % (testcase_func.__name__,
                      parameterized.to_safe_name(str(param.args[0])))
def even_case_name(testcase_func, param_num, param):
    (value, ) = param.args
    return parameterized.to_safe_name(
        str(testcase_func.__name__ + "_custom_" + str(value)))
def custom_name_func_param_num(testcase_func, param_num, param):
    return "{}_{}_{}".format(
        testcase_func.__name__,
        param_num,
        parameterized.to_safe_name("_".join("{}_{}".format(key, val) for key, val in param.kwargs.items())))