Skip to content

Commit

Permalink
update to handle implicit toxenv coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
raubitsj committed Aug 10, 2022
1 parent 7466d27 commit 157c497
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tools/coverage-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ def parallelism_expand(cov_list, par_dict):
return ret


def augment_circle_config(data: dict):
"""pytest jobs have implicit toxenv."""
data = copy.deepcopy(data)
jobs = data.get("workflows", {}).get("main", {}).get("jobs")
special_job_name = "pytest"
for job in jobs:
special_job = job.get(special_job_name)
if special_job:
special_job[
"toxenv"
] = "py<<matrix.python_version_major>><<matrix.python_version_minor>>,covercircle"
return data


def coverage_tasks(args: argparse.Namespace):

ci_fname = args.circleci_yaml
Expand All @@ -130,7 +144,8 @@ def coverage_tasks(args: argparse.Namespace):

parallelism = find_list_of_key_locations_and_dicts(data, "parallelism")
parallelism_defaults = filter(find_parallelism_defaults, parallelism)
toxenv = find_list_of_key_locations_and_dicts(data, "toxenv")
augmented_data = augment_circle_config(data)
toxenv = find_list_of_key_locations_and_dicts(augmented_data, "toxenv")
toxenv_cov = filter(lambda x: "covercircle" in x[1]["toxenv"], toxenv)
toxenv_cov_matrix = matrix_expand(toxenv_cov)
par_default_dict = create_parallelism_defaults_dict(parallelism_defaults)
Expand Down

0 comments on commit 157c497

Please sign in to comment.