[Bf-python] questions about best practice

Dan Eicher dan at eu.phorio.us
Wed Dec 3 20:53:33 CET 2014


On Wed, Dec 3, 2014 at 9:05 AM, Jenny <caretdashcaret at gmail.com> wrote:

> Hello,
>
> I have a few questions.
>
> I was wondering what are the best practices for testing Blender scripts /
> add-ons. Are there testing frameworks that can be easily integrated? How
> should I go about writing tests when my functions are a series of operator
> calls? Should I mock them?
>
>
You can run python unittest from inside blender, I used to do this when
messing with the bpy to hunt bugs or make sure I didn't break anything when
adding new stuff.



> Secondly, when I open a script in the Blender Text Editor to run, and I'm
> using an external module or package, how do I add that module / package to
> the path? Right now, in my script, `import foo` just gets me `No module
> named foo`.
>
>
> I tend to use sys.path.append() a lot since fedora doesn't have
/usr/local/lib in python's default path but you can also drop the module in
blender's addon module directory too. Not really sure how it works when
python is bundled with blender though...

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20141203/91b305cd/attachment.html>


More information about the Bf-python mailing list