[Avocado-devel] subclassing avocado

Lukáš Doktor ldoktor at redhat.com
Wed Nov 7 06:32:46 UTC 2018


Dne 06. 11. 18 v 20:41 Brian J. Murrell napsal(a):
> On Tue, 2018-11-06 at 20:16 +0100, Lukáš Doktor wrote:
>>
>> Yes, this is related to the fact that the code is not being executed,
>> but only analyzed on discovery.
> 
> The only difference between the two test_example.py files though is
> what it adds via sys.path.append():
> 
> -sys.path.append('./')
> +sys.path.append('./util/apricot')
> 
> I'm having trouble understanding why one of those works and the other
> doesn't.
>  

As mentioned in previous email, Avocado is not executing the code to discover the tests, therefor it fails to analyze the `test_example.py`, because there is an unknown import. The first one works for me because `apricot` is a local import (meaning it's in PYTHONPATH, because it's the current directory).

> 
>> Anyway to workaround this issue you can always set PYTHONPATH
>> directly on cmdline:
> 
> That does seem to work, but is big ugly.  :-(
> 

Actually extending PYTHONPATH is cleaner than extending it programatically via `sys.path`. The right solution is to deploy your subclass library.

Regards,
Lukáš

> Cheers,
> b.
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/avocado-devel/attachments/20181107/865b608d/attachment.sig>


More information about the Avocado-devel mailing list