• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Testing in Python

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Coming from the Java world, I've grown used to having solid testing frameworks such as JUnit and TestNG. Does Python have similar testing frameworks? I just starting taking a Python course at Coursera and I didn't see any mentions of testing frameworks in that class. I'm starting to learn Python to help with scripting Linux deployments. Another popular language for that work is Ruby which has a very strong testing background.

Thank you,
David
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Python has a unittest module: http://docs.python.org/library/unittest.html
 
David DeCesare
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Steve! Reading through that site, it looks very similar to the Java testing tools (which is great). Just out of curiosity, based on your experience is testing in Python viewed as important as it is in the Ruby community? I apologize for the newbie questions but I just started with Python :-).

Thanks again,
Dave
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My experience is probably not the best in this case. I use Python as a scripting add-in to another application. Scripts tend to be short and targeted, and not well tested (but really not have many failure points either). I have used the unittest module a bit but I think of those I work with I am in the minority.

If you are writing a large project or stand-alone application then I think the need to unit test your application is the same as any other language.
 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try PyUnit (http://pyunit.sourceforge.net).
 
Author
Posts: 28
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use PyUnit and I think it is very good, but I have to admit that testing and test-driven design might not be as ingrained in the Python programmer culture as it is in others.

But as Python is applied to bigger projects, and used in environments with better software engineering practices, I would expect that to change (maybe it already is).

Allen
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic