2020-01-30 22:21:33 +01:00
|
|
|
"""Erase code coverage files."""
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
from ..util_common import (
|
|
|
|
ResultType,
|
|
|
|
)
|
|
|
|
|
|
|
|
from . import (
|
|
|
|
CoverageConfig,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-02-06 07:16:15 +01:00
|
|
|
def command_coverage_erase(args): # type: (CoverageConfig) -> None
|
|
|
|
"""Erase code coverage data files collected during test runs."""
|
2020-01-30 22:21:33 +01:00
|
|
|
coverage_dir = ResultType.COVERAGE.path
|
|
|
|
|
|
|
|
for name in os.listdir(coverage_dir):
|
|
|
|
if not name.startswith('coverage') and '=coverage.' not in name:
|
|
|
|
continue
|
|
|
|
|
|
|
|
path = os.path.join(coverage_dir, name)
|
|
|
|
|
|
|
|
if not args.explain:
|
|
|
|
os.remove(path)
|