Using py.test on Windows

Well..if you guys have been reading my stuff, you’ll know that I’ve done all my development so far on Ubuntu 10.04, Python 2.6 and Suds 0.4 (I think :)). And I’ve been churning out plenty of unit tests too for all those Web Service methods. Remember there were 121? I’ve made quite a bit of progress though; which you can see here.

Now all my unit tests were written using py.test on Linux. So when I pinged Dinis today, he mentioned that it was cool that so many tests were getting written, but he wanted a way to run them in Windows .. maybe after every build itself. So for that he wanted me to find out exactly how he could run these tests in Windows. So after a little bit of playing around, it turns out it isn’t too hard at all :). Here are the steps:

a) Install Python 2.6 for Windows. The main version. Not Iron Python. It might well work with that as well but I didn’t try. There’s a newer version out, but I’d written all my code in Linux on Python 2.6 so I figured I’d keep it simple to start off.

b) Add c:\Python26\Scripts to the Windows path. Replace the path if you have installed Python elsewhere.

c) Now install Suds. Open up CMD and type easy_install -U suds.

d) Install Py.test. Type easy_install -U pytest

e) Remove the __pycache__directories from inside the Unit test directories if those exist. This is needed coz all my code was written on Linux and the cache will contain stuff specific to Linux..which I don’t need here.

f) That’s it. Run your unit test.  Here’s a sample screenshot 🙂

So if you want to have a look at what I’ve pushed over to Git, you can always do so by looking here and here. Hopefully by the end of this week..I should be through with all the Unit tests..unless Dinis gives me something else to do :). Cya.

Advertisements
This entry was posted in UnitTests, WebServices. Bookmark the permalink.

2 Responses to Using py.test on Windows

  1. Pingback: Considerations for testing TeamMentor with Jenkins CI | TeamMentor Development and Testing

  2. Thank you for the article

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s