# Workflow for testing when using VS Code?

**URL:** <https://discourse.mcneel.com/t/workflow-for-testing-when-using-vs-code/113342>\
**Category:** Scripting\
**Tags:** ghpython, testing, python, rhino6, grasshopperrhino\
**Created:** [November 27, 2020, 11:29pm UTC](https://discourse.mcneel.com/t/workflow-for-testing-when-using-vs-code/113342 "2020-11-27T23:29:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ed.p.may](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ed.p.may/32/508653_2.png) [@ed.p.may](https://discourse.mcneel.com/u/ed.p.may)\
**Post date:** [November 27, 2020, 11:29pm UTC](https://discourse.mcneel.com/t/workflow-for-testing-when-using-vs-code/113342/1 "2020-11-27T23:29:03Z")

</div>

Hello everyone,

I am wondering if anyone has a good workflow for doing Unit-Tests on Python modules which are used by GHPython components when I am creating those modules in VS Code or similar external IDE?

* * *

For example:

I can create components in Grasshopper which import and use my custom modules - that all works great:

 ![Screen Shot 2020-11-27 at 6.05.17 PM](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/7/5/2759211e582f73b0fde71ffb84abb0ba74df5443.png)

 ![Screen Shot 2020-11-27 at 6.08.16 PM](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/5/5/c5591c5810ba358704cfd4a0a137937ddc1b1fc5.png)

and I can write those modules outside Rhino/GH (I’m using VS Code at the moment) and that is all working fine as well. Though I am not able to make the ‘[stubs](https://discourse.mcneel.com/t/autocomplete-while-editing-python-scripts-outside-of-rhino/79329)’ work unfortunately, so I am still not getting any autocomplete. But that’s not the end of the world, and when I run everything in Grasshopper it all works just fine.

* * *

So the only issue I run into is if I try and create any Unit-Tests which import my custom module(s). If my module includes Rhino / Grasshopper module imports (which they almost all do), I get an error when I try and run the tests:

 ![Screen Shot 2020-11-27 at 6.10.41 PM](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/4/d/84d3e09e08063b54cbf4fa844d3f6a4f037cc71d.png)

So I wonder if there is good workflow / process that I should be using for something like this? I can do UnitTests for the functions inside Grasshopper using the process outlined [here](https://discourse.mcneel.com/t/using-unittest-in-rhino-python-not-possible/15364/3), so that is helpful, but I’d like to be able to integrate more testing into my modules as well? Do I need to setup VS Code in some particular fashion to allow my to access those Rhino/GH modules somehow? Is there some other preferred method I should be using to do tests on GHPython modules?

any advice or recommendations are much appreciated!  
thanks so much.  
@ed.p.may
