0

I'm trying to use pyresttest's benchmarking framework to generate a sequence of entries in my flask_sqlalchemy-based database. I would like to read input values from a pre-defined list as advertised by this framework's benchmarking generator type 'fixed_sequence', but it's only picking up the first element of the list.

Here is the issue that explains my problem in detail, with an example: https://github.com/svanoort/pyresttest/issues/264

Any pointer in the right direction will be greatly appreciated

kip2
  • 6,473
  • 4
  • 55
  • 72

1 Answers1

0

I looked into the code, it is jsut a bug, this feature was never used by anyone. https://github.com/svanoort/pyresttest/blob/master/pyresttest/generators.py#L100 instead of: ``` def factory_fixed_sequence(values): """ Return a generator that runs through a list of values in order, looping after end """

def seq_generator():
    my_list = list(values)
    i = 0
    while(True):
        yield my_list[i]
        if i == len(my_list):
            i = 0
return seq_generator

It should be: def factory_fixed_sequence(values): """ Return a generator that runs through a list of values in order, looping after end """

def seq_generator():
    my_list = list(values)
    i = 0
    while(True):
        yield my_list[i]
        i += 1
        if i == len(my_list):
            i = 0
return seq_generator

```

The i += 1 is missing

naviram
  • 1,445
  • 1
  • 15
  • 26