Can python coverage module conditionally ignore lines in a unit test?
问题 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