Repository navigation
Allow to pass listener instances to robot.run - #1987
Conversation
|
Admin, can CI be enabled? |
There was a problem hiding this comment.
Should check against basetring to allow passing listener name as str and unicode.
|
This looks very good! I especially like that you have added some unit tests for this functionality. There are, however, few issues still to be sorted out. I already added some line notes, but there are few additional things to do or at least consider:
|
|
@robotci: Whitelist |
|
hello, I have improved code according to your comments. I have added test for TestSuite.run and seems there is a problem. When listeners are registered in one TestSuite.run call, they are still active in following calls. I am trying to figure out what is root cause of this behaviour. |
|
I just checked this with master branch (with .py file module listeners) and behaviour is the same. Seems listener are not unregistered correctly after TestSuite.run call. I will investigate it more unless you have some idea. |
|
Interesting. Sounds like a bug to me. We've had similar problems with preserved state when using programmatic APIs also earlier. If you have confirmed this, please submit a separate issue about it. If you have found a fix, please also submit a separate PR. |
|
I have added bit of documentation. Also created issue about listeners not being unregistered between TestSuite.run calls: #1992 |
There was a problem hiding this comment.
I understand that you only wanted to support listeners, but I nevertheless think it would be OK to just modify _split_args_from_name_or_path to have this at the beginning:
if not isinstance(value, basestring):
return value, []If someone passes non-string value to other settings, things will break anyway. A big benefit would be that I could add support for instances to model modifiers separately.
|
This looks great! Please take a look at the line notes and comment if you disagree with them. One thing I don't like so much anymore in the overall design is that in settings listeners etc. would be a tuple def __init__(self, listener):
if isinstance(listener, basestring):
name, args = utils.split_args_from_name_or_path(listener)
listener = self._import_listener(name, args)
else:
name = utils.type_name(listener)
# ...I think this would be better design than what we decided earlier. What do you think @WojtekKowaluk? If you agree, should we switch to that design immediately or first implement this using the original design and then refactor? |
|
I also think this current solution is not very elegant. I will attempt to refactor it like you say. |
|
Great! A good first step would be just creating the |
|
I have refactored the code. I also went with your other suggestion except adding state to test listener (just skipped it for now, I'm not saying it's bad idea). What do you think? |
There was a problem hiding this comment.
This isn't needed if nothing special is done the value.
|
Fixed. |
|
Looks great! Please squash the commits and I'm happy to merge this. Do you want to continue w/ var files and modifiers or should I take care of them? |
|
Commits are squashed. I can continue with var files and visitors in new PR if you don't mind waiting for it a bit. |
Allow to pass listener instances to robot.run. Part of #1969.
implements #1969