waldenner / robotframework

Automatically exported from code.google.com/p/robotframework
Apache License 2.0
0 stars 0 forks source link

Inheriting ExecutionFailed exception without calling ExecutionFailed.__init__ crashes test execution with RF 2.5 #591

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If exception raised from library is inheriting RF's ExecutionFailed exception, 
test execution can crash (Unexpected error: AttributeError: 'MyException' 
object has no attribute 'cont'). This failure can happen if 
ExecutionFailed.__init__ is not called in RF 2.5. In 2.1.2 and older, there 
have not been __init__ in ExecutionFailed and therefore upgrading can cause 
this exception.

Attached is files that can be used to reproduce the problem.

I think there is two options with this:
1) No code changes, just help people to upgrade their libraries in case someone 
have this problem
2) Add __getattr__ which informs wrong usage of the ExecutionFailed exception 
and provides default values for timeout, syntax, exit and cont attributes.

Original issue reported on code.google.com by jpran...@gmail.com on 14 Jul 2010 at 8:20

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by jpran...@gmail.com on 14 Jul 2010 at 8:20

GoogleCodeExporter commented 9 years ago
I don't think anything should be done on RF side. Not calling __init__ of the 
class you extend is a bug in the client code. There are countless ways you can 
crash the execution if you use the internal modules wrong way. Adding 
workarounds for them in the framework doesn't, in my opinion, make much sense.

Original comment by pekka.klarck on 14 Jul 2010 at 8:46

GoogleCodeExporter commented 9 years ago
I just checked that `timeouted` attribute was added to `ExecutionFailed` in RF 
2.1.3. The provided example wouldn't probably work in that version either.

Original comment by pekka.klarck on 14 Jul 2010 at 8:59

GoogleCodeExporter commented 9 years ago
I agree, the only problem is that upgrading cause valid (RF 2.1.2) library code 
to crash the test execution with RF 2.5. Anyway, we can probably close this 
issue? 

Original comment by jpran...@gmail.com on 14 Jul 2010 at 12:56

GoogleCodeExporter commented 9 years ago
The example library isn't actually valid (not calling __init__ is a bug) even 
if it did work in RF 2.1.2. I don't actually see any reason a library should 
use ExecutionFailed itself. Why isn't a normal exception enough?

Anyway, I really think we shouldn't do anything for this on RF side and mark 
this WontFixed. Fixing this on the library is trivial and I don't believe there 
are that many libraries out there that are affected.

Original comment by pekka.klarck on 14 Jul 2010 at 9:02