Slashdot Mirror


Testing Frameworks in Python

An anonymous reader writes "This article looks at Python's two standard modules for unit testing: unittest and doctest. These modules expand on the capability of the built-in assert statement, which is used for validation of pre-conditions and post-conditions within functions. The author discusses the best ways to incorporate testing into Python development, weighing the advantages of different styles for different types of projects."

5 of 120 comments (clear)

  1. Traditional testers might be interested... by tcopeland · · Score: 5, Informative

    ...in Bret Pettichord's Scripting for Testers one day class.

    It talks about eliminating some of the tediousness from testing web applications, mainly by using automated solutions like WTR.

    He's also got a list of testing resources that's got some good stuff in there...

  2. bull by kpharmer · · Score: 5, Informative

    A few thoughts:

    1. I've never had a problem with memory management in python. Can't say it doesn't exist, just never impacted my production applications.

    2. Implementing great built-in test frameworks doesn't need to wait for memory management improvements. I'm seeing almost immediate pay-offs from this kind of built-in testing.

    3. I'm implementing python as an alternative to java in large applications - with complete success. Easy to learn, easy to maintain, fast enough to handle millions of rows of data a day - what's not to like?

  3. Testing.. by MosesJones · · Score: 4, Informative


    I hate to break it to the hack and slashdot crowd, but Testing is actually a whole career in itself, and the application of different testing processes and methods to different projects is a critical part of ensuring projects succeed.

    This article covers NOTHING about the different types of testing on a project, or indeed how test cases should even be constructed. Its basically about some UnitTesting elements that could be done by testing.

    I know its unpopular here on Slashdot to claim that there are more developers working on big projects than people hacking in Python. Buts its articles like these that underline the difference between professional software development and hacking.

    This is about hacking.

    --
    An Eye for an Eye will make the whole world blind - Gandhi
  4. Re:Python's dirty little secret by smallpaul · · Score: 5, Informative

    It is clear you do not know anything about Python. You are not a long-time Python developer but rather a troll. The first hint is that you misspell Guido Van Rossum's name.

    The second hint is that you cite a page from 1999. A Python developer would know that that was before Python had cyclic garbage collection. Here is an article from 2001 that describes how the issue was fixed.

    The third hint is that you point to a page that describes how to avoid creating a memory leak by appending an infinite number of items to a list. Guess what: appending an infinite number of items to a list causes a memory leak in Java, C++, C, assembly, Scheme, sh, Perl and every other programming language in the world. If you ask the computer to store a continually growing list of items, it will do so...in any language.

    If you think that Python can leak memory in circumstances where other languages would not, post an example program and we'll all test it out.

  5. Re:Python's dirty little secret by Lulu+of+the+Lotus-Ea · · Score: 4, Informative

    FWIW, I'm the author of the referenced testing article. Though that's not really germane to the following comment.

    b.foster's misguided comment gives a link to a 1999 article about problems in Python with cleaning up circular references. Well, yeah: in 1999, Python 1.5.2 could leak on circular references. It was actually less of a problem in practice than advocates of mark-and-sweep collectors tended to complain about; but it really was a limitation. That was a long time ago.

    Nowadays, Python still uses references counting as its primary collection mechanism. It's a nice system: fast, deterministic, etc. (despite what you might think, refcount *really is* faster than Bohm generational; and is well-tested as such by very smart Python developers). However, the last half-decade of Python versions also perform occassional checks for orphaned objects, and cleans them up too. The "problem" pointed to is of historical interest, at most.