developerWorks: Testing Frameworks in Python | Linux Today

developerWorks: Testing Frameworks in Python

Written By
Web Webster
Web Webster
Apr 13, 2004

“I have a confession. Even as the author of a public domain
Python library in fairly wide use, I have been far less than
systematic in including unit tests for my modules. In fact, the
bulk of those tests that are included in Gnosis Utilities fall
under gnosis.xml.pickle, and were written by a contributor to that
subpackage. I have found that the large majority of third-party
Python packages I download also lack a thorough unit test
collection.

“Moreover, the tests that exist in Gnosis Utilities suffer from
another flaw: you often need to understand the expected output in a
fair amount of detail to even know whether a test succeeds or
fails. What passes as tests are actually — in many cases — more
like small utilities that utilize parts of the library. These tests
(or utilities) allow input from arbitrary data sources (of the
right type) and/or output in descriptive data formats. These test
utilities are actually rather useful when you need to debug some
subtle error. But as self-explanatory sanity checks of changes
between library versions, these kinds of tests do not succeed.

“In this installment, I try to improve the tests in my utility
collection using the Python standard library modules doctest and
unittest, and I walk you through my experience (with a few pointers
on best approaches)…”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.