[Python Wpg] Testing for Python version
Sydney Weidman
syd at plug.ca
Tue Oct 16 18:31:43 CEST 2007
Hi, all!
I'm trying to create doctests that will work on multiple platforms, each
with different versions of Python. OSX includes version 2.3.0, which
doesn't have doctest.ELLIPSIS constant available, so I need to skip
using that constant on OSX. It seems as if the idiom for testing Python
version is sys.version_info[:3] >= (2,4,0):
import sys
import doctest
def _test(verbose)
if sys.version_info[:3] >= (2,4,0):
doctest.testmod(verbose=verbose,optionflags=doctest.ELLIPSIS)
else:
doctest.testmod(verbose=verbose)
Does this seem like the "right" way to test python version?
I can't seem to find any definitive documentation about how to do this.
- syd
More information about the Winnipeg
mailing list