Skip to content

Commit

Permalink
reconfigure tests to cycle through all possible values for fields tha…
Browse files Browse the repository at this point in the history
…t are nominally independent
  • Loading branch information
chrisjkuch committed Oct 24, 2023
1 parent b4cf190 commit 40a4baa
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
import tempfile
from contextlib import contextmanager
from itertools import product
from itertools import cycle, product
from pathlib import Path

import pytest
Expand All @@ -19,8 +19,6 @@
"module_name": "project_module",
"author_name": "DrivenData",
"description": "A test project",
"open_source_license": "MIT",
"dataset_storage": {"azure": {"container": "container-name"}},
}


Expand Down Expand Up @@ -58,14 +56,23 @@ def _is_valid(config):

# remove invalid configs
configs = [c for c in configs if _is_valid(c)]
include_code_scaffold = True

# cycle over all values other multi-select fields that should be inter-operable
# and that we don't need to handle with combinatorics
cycle_fields = [
"dataset_storage",
"open_source_license",
"include_code_scaffold",
"docs",
]
cyclers = {k: cycle(cookiecutter_json[k]) for k in cycle_fields}

for ind, c in enumerate(configs):
config = dict(c)
config.update(default_args)
# Alternate including the code scaffold
config["include_code_scaffold"] = "Yes" if include_code_scaffold else "No"
include_code_scaffold = not include_code_scaffold
for field, cycler in cyclers.items():
config[field] = next(cycler)
config["repo_name"] += f"-{ind}"
yield config

Expand Down

0 comments on commit 40a4baa

Please sign in to comment.