Loading unittest_extra/coverage_report.py +4 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ A module to produce coverage reports for testing. """ from six import string_types from six import string_types, PY3 from itertools import product from functools import wraps from fnmatch import fnmatch Loading @@ -35,6 +35,7 @@ import itertools import logging import pkgutil import sys import io def _import_module(module, exclude): Loading Loading @@ -100,7 +101,8 @@ def coverage_report(modules, include=None, exclude=None, file=None): cover.stop() cover.save() with (file or sys.stdout) as file: mode = 'w' if PY3 else 'wb' with file or io.open(sys.stdout.fileno(), mode, closefd=False) as file: if file.isatty(): file.write("\nCoverage Report:\n================\n") cover.report(list(modules), include=include, omit=exclude, file=file) Loading Loading
unittest_extra/coverage_report.py +4 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ A module to produce coverage reports for testing. """ from six import string_types from six import string_types, PY3 from itertools import product from functools import wraps from fnmatch import fnmatch Loading @@ -35,6 +35,7 @@ import itertools import logging import pkgutil import sys import io def _import_module(module, exclude): Loading Loading @@ -100,7 +101,8 @@ def coverage_report(modules, include=None, exclude=None, file=None): cover.stop() cover.save() with (file or sys.stdout) as file: mode = 'w' if PY3 else 'wb' with file or io.open(sys.stdout.fileno(), mode, closefd=False) as file: if file.isatty(): file.write("\nCoverage Report:\n================\n") cover.report(list(modules), include=include, omit=exclude, file=file) Loading