Using nosetests and the coverage module, I would like coverage reports for code to reflect the version being tested. Consider this code:
import sys
if sys.version_info < (3,3):print('older version of python')
When I test in python version 3.5, the print()
shows up as untested. I'd like to have coverage ignore that line, but only when I'm testing using python version 3.3+
Is there a way to do something like # pragma: no cover
on the print()
statement only for when sys.version_info
is not less than (3,3)
? Effectively, I'd like to do something like this:
import sys
if sys.version_info < (3,3):print('older version of python') # pragma: [py26,py27,py32] no cover