5e68bb3d93
* Refactor coverage file enumeration. * Relocate sanitize_filename function. * Support sets when writing JSON files. * Generalize setting of info_stderr mode. * Split out coverage path checking. * Split out collection regex logic. * Improve sanitize_filename type hints and docs. * Clean up coverage erase command. * Fix docs and type hints for initialize_coverage. * Update type hints on CoverageConfig. * Split out logic for finding modules. * Split out arc enumeration. * Split out powershell coverage enumeration. * Raise verbosity level of empty coverage warnings. * Add code coverage target analysis to ansible-test.
27 lines
645 B
Python
27 lines
645 B
Python
"""Erase code coverage files."""
|
|
from __future__ import (absolute_import, division, print_function)
|
|
__metaclass__ = type
|
|
|
|
import os
|
|
|
|
from ..util_common import (
|
|
ResultType,
|
|
)
|
|
|
|
from . import (
|
|
CoverageConfig,
|
|
)
|
|
|
|
|
|
def command_coverage_erase(args): # type: (CoverageConfig) -> None
|
|
"""Erase code coverage data files collected during test runs."""
|
|
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)
|