Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Is it possible to unit-test python code in a .bbclass file?

$
0
0

We ran across the problem, that we have some complex code in one of our .bbclass files in our project, and would like to unit test it. But we don't really see a way to achieve this. Right now we basically copied out the python code into it's own file, and ran some tests over it, but this is not really a solution for a productive environment.

foo.bbclass

def foobar(some_text):    # do some transformations with the text and return it    return some_text[:2:-3].upper()SOME_VARIABLE := "${foobar("asdfg")}"

Obviously symlinking the file to .py and importing it doesn't work, since the .bbclass syntax contains elements the python parser will choke on. So is there a way to apply tests to it?


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>