[py-dev] Testing and Coverage against different python interpreter versions

James Mills prologic at shortcircuit.net.au
Wed Apr 21 04:43:44 CEST 2010


Hi All,

I am in need of a solution regarding the use of py.test and pytest-coverage
(the coverage plugin I help maintain for py.test).

The problem is being able to run a test suite against 2 or more different
python interpreter versions (eg: 2.5 and 2.6) AND combining their
coverage data.

Without the above behavior, it would not be possible to achieve 100% code
coverage (by tests). Often (at least I do) in situations where you
wish to support
2 or more different versions of python you might have:

try:
   import foo # 2.6 import
except ImportError:
   import bar # 2.5 import

and

if sys.version_info[:2] == (2, 6):
   # 2.6 code
else:
   # 2.5 code

Currently I have no solution for this, I'm hoping others might have
some ideas or are already working on something similar that might
achieve this.

cheers
James

--
-- "Problems are solved by method"



More information about the Pytest-dev mailing list