This project has moved and is read-only. For the latest updates, please go here.

visual studio unit test adapter for python

Dec 8, 2012 at 1:23 PM

I recently got to know about PTVS and used it for a small project. Auto-complete and the debugging capabilities are awesome!

I wrote some unit tests too (based on unittest module). But couldn't find unit tests related integration with VS. For example it would be nice to have:-

1. "Python unit tests" project template.

2. A unit test adapter for visual studio 2012 which will enable VS to discover the test cases and list them under test explorer (and execute them too, of course!)

Does something like this already exist or any work being done already?

If not, I would like to contribute.

Dec 10, 2012 at 4:42 PM


We do have some work underway on the test adapter, so hopefully we'll have that available in our next release.

The project template is not something we've discussed yet, so if you'd like to contribute that we'd love to take a look. (Even better would be a project wizard that can use our analyzer module to generate basic tests, though I'll understand if you're not offering that much free work :) )

Dec 10, 2012 at 10:00 PM
Edited Dec 10, 2012 at 10:46 PM

This is what I had in mind for the template. Create a simple .pyproj and a <ProjectName> file. The .py file could be extremely simple and static:

import unittest

class MyTestClass(unittest.TestCase):
    def test_method(self):

if __name__ == "__main__":

Did you have something in mind, where we can look at the product code and then generate blank test methods for every method of every class? (I don't know anything about the analyzer module)

Dec 10, 2012 at 10:43 PM

I have a lot of things in mind, which is a luxury that I get because I don't have to decide whether we can afford the time to implement it :)

We'll be meeting internally this week to plan our next major release, which will almost certainly feature unit testing. Depending on how we rank other features (to get an idea of what we'll be looking at, go to the Issue Tracker and sort by votes), we may get to do something clever with generating tests. We'll certainly have at least a template like that one, but if we can be more helpful for developers then we will be.

Dec 10, 2012 at 11:40 PM

I see "unit test integration" is running 3rd in the issue tracker, which is good :)

I would be happy to know what get's decided in the meeting.

May 18, 2013 at 3:17 AM
Zooba wrote:
We do have some work underway on the test adapter
Can you share what you have? I've been wanting to write a Python unittest adapter for a while but I don't know the best way to get the results back into Visual Studio.