Passing .NET objects to Python

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing .NET objects to Python

Meredith, Christopher

Greetings.

 

I have a test framework written in C# that handles test execution, logging, reporting, etc., and some tests for some of our hardware that are written in Python.  Ideally, I’m wanting to call Setup(), Run() and TearDown() methods defined in Python scripts, passing them an instance of the object I have that handles logging as a parameter (or defining it globally from the perspective of the loaded script).  Whilst I can find methods that load entire Python scripts and call them from .NET, I can’t seem to find anything in the documentation or defined publicly in Python.Runtime.dll.  Is this doable?  Is this documented?

 

Thanks,

Chris Meredith

Test Engineer, North American Embedded Professional Services

Email: [hidden email]


_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet
Reply | Threaded
Open this post in threaded view
|

Re: Passing .NET objects to Python

Barton
The source code for the pythondotnet project has a great example of
this. There is a copy [although, not quite up-to-date] of the project on
the github repository which even has nUnit unit test framework built in.

This project uses pure python to load the test assembly via unittest for
a fairly complete test of the pythondotnet assembly itself.

On 06/05/2011 03:06 PM, Meredith, Christopher wrote:

> Greetings.
>
> I have a test framework written in C# that handles test execution,
> logging, reporting, etc., and some tests for some of our hardware that
> are written in Python. Ideally, I’m wanting to call Setup(), Run() and
> TearDown() methods defined in Python scripts, passing them an instance
> of the object I have that handles logging as a parameter (or defining it
> globally from the perspective of the loaded script). Whilst I can find
> methods that load entire Python scripts and call them from .NET, I can’t
> seem to find anything in the documentation or defined publicly in
> Python.Runtime.dll. Is this doable? Is this documented?
>
> Thanks,
>
> Chris Meredith
>
> Test Engineer, North American Embedded Professional Services
>
> Email: [hidden email]
> <mailto:[hidden email]>
>
>
>
> _________________________________________________
> Python.NET mailing list - [hidden email]
> http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
Python.NET mailing list - [hidden email]
http://mail.python.org/mailman/listinfo/pythondotnet