Custom Action with table

2 views
Skip to first unread message

Mauricio Lima

unread,
Feb 15, 2011, 4:13:30 PM2/15/11
to pyccuracy
Hi

Im trying to implement a custom action with a table parameter, but it
fails, the test and the failure message:
[test]
Given
I have the following registered users:
| username | email | password |
| admin | a...@ad.cc | aidimin |

And I am logged in with username "admin" and password "aidimin"
[/test]

[error]
Scenario.......3 - Operating at descending ratio
Given
I have the following registered users:
| username | email | password |
| admin | a...@ad.cc | aidimin |
And I am logged in with username "admin" and
password "aidimin" - FAILED - Error executing action <bound method
RegisterUsers.execute of <actions.RegisterUsers object at 0xa0c8bcc>>
- Traceback (most recent call last):
File "/home/mauricio/devel/hacktrade-env/lib/python2.6/site-packages/
pyccuracy/fixture_items.py", line 99, in execute
self.execute_function(context, *self.args, **self.kwargs)
TypeError: execute() got multiple values for keyword argument 'table'

[/error]

Is it a bug or am i missing something?

tks

Mauricio Souza Lima

Bernardo Heynemann

unread,
Feb 15, 2011, 6:45:35 PM2/15/11
to pycc...@googlegroups.com
Very likely a bug...

I'll check.

Ty,
Bernardo Heynemann

> --
> You received this message because you are subscribed to the Google Groups "pyccuracy" group.
> To post to this group, send email to pycc...@googlegroups.com.
> To unsubscribe from this group, send email to pyccuracy+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyccuracy?hl=en.
>
>

Mauricio Lima

unread,
Feb 16, 2011, 12:01:56 PM2/16/11
to pyccuracy
Hi!

I was investigating myself the code to maybe help debugging it and i
found this:
At the pyccuracy.parsers.FileParser, the function get_line_identation
does not correctly calculate the real identation, it only counts space
chars, be it at start or at the end.
At pyccuracy.actions.ActionRegistry the suitable_for function returns
the expected args and kwargs, but for table parameters, it has no
kwargs, and if i put the "(And)?" optional, it will get passed down as
(None,) args, example:

class RegisterUsers(ActionBase):
regex = r'^(And )?I have the following registered users:$'
def execute(self, context, table):
pass

The matches will be (None,) as args and {} as kwargs, following up the
code at FileParser.parse_story_file, it will inject the key 'table' at
kwargs, so the call will be:
execute(self,context,None,table=table)
Thus, raising the exception just like this example:
>>> def x(a,b):
... return a+b
...
>>> x(1,2,b=3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: x() got multiple values for keyword argument 'b'

I hope this helps fixing this problem, i created a quickfix here but i
dont think its the optimal solution, if needed i can publish the fix.

Thanks,

Mauricio Souza Lima


On Feb 15, 9:45 pm, Bernardo Heynemann <heynem...@gmail.com> wrote:
> Very likely a bug...
>
> I'll check.
>
> Ty,
> Bernardo Heynemann
>

Bernardo Heynemann

unread,
Feb 16, 2011, 12:12:59 PM2/16/11
to pycc...@googlegroups.com
Please fork the project, apply your fix and send a pull request. :)
This way I can easily verify if your fix does it. :)

Thank you VERY much for the interest!

Cheers,
Bernardo Heynemann

Mauricio Lima

unread,
Feb 16, 2011, 2:35:24 PM2/16/11
to pyccuracy
Will do.

Glad to be of help.

Mauricio Souza Lima

On Feb 16, 3:12 pm, Bernardo Heynemann <heynem...@gmail.com> wrote:
> Please fork the project, apply your fix and send a pull request. :)
> This way I can easily verify if your fix does it. :)
>
> Thank you VERY much for the interest!
>
> Cheers,
> Bernardo Heynemann
>
Reply all
Reply to author
Forward
0 new messages