Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions conda_forge_tick/migrators/cos7.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@


class Cos7Config(MiniMigrator):
allowed_schema_versions = {0, 1}

def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool:
if super().filter(attrs):
return True

Check warning on line 65 in conda_forge_tick/migrators/cos7.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/cos7.py#L65

Added line #L65 was not covered by tests

if any(
SYSROOT_REGEX.search(line) for line in attrs["raw_meta_yaml"].splitlines()
):
Expand Down
4 changes: 4 additions & 0 deletions conda_forge_tick/migrators/duplicate_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@


class DuplicateLinesCleanup(MiniMigrator):
# duplicate keys are an error in v1 recipes
allowed_schema_versions = {0}
regex_to_check = {
"noarch: generic": re.compile(r"^\s*noarch:\s*generic\s*$"),
"noarch: python": re.compile(r"^\s*noarch:\s*python\s*$"),
}

def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool:
if super().filter(attrs):
return True

Check warning on line 22 in conda_forge_tick/migrators/duplicate_lines.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/duplicate_lines.py#L22

Added line #L22 was not covered by tests
# we are not handling outputs here since they can make things confusing
if "outputs" in attrs.get("meta_yaml", ""):
return True
Expand Down
29 changes: 22 additions & 7 deletions tests/test_cos7_config_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@
piggy_back_migrations=[Cos7Config()],
)

YAML_PATH = os.path.join(os.path.dirname(__file__), "test_yaml")
YAML_PATHS = [
os.path.join(os.path.dirname(__file__), "test_yaml"),
os.path.join(os.path.dirname(__file__), "test_v1_yaml"),
]


@pytest.mark.parametrize("remove_quay", [False, True])
@pytest.mark.parametrize("case", list(range(len(REQUIRED_RE_LINES))))
def test_version_cos7_config(case, remove_quay, tmp_path):
with open(os.path.join(YAML_PATH, "version_cos7_config_simple.yaml")) as fp:
@pytest.mark.parametrize("recipe_version", [0, 1])
def test_version_cos7_config(case, remove_quay, recipe_version, tmp_path):
with open(
os.path.join(YAML_PATHS[recipe_version], "version_cos7_config_simple.yaml")
) as fp:
in_yaml = fp.read()

with open(
os.path.join(YAML_PATH, "version_cos7_config_simple_correct.yaml"),
os.path.join(
YAML_PATHS[recipe_version], "version_cos7_config_simple_correct.yaml"
),
) as fp:
out_yaml = fp.read()

Expand Down Expand Up @@ -49,6 +57,7 @@ def test_version_cos7_config(case, remove_quay, tmp_path):
"version": "0.9",
},
tmp_path=tmp_path,
recipe_version=recipe_version,
)
with open(cfg) as fp:
cfg_lines = fp.readlines()
Expand All @@ -58,12 +67,17 @@ def test_version_cos7_config(case, remove_quay, tmp_path):


@pytest.mark.parametrize("case", list(range(len(REQUIRED_RE_LINES))))
def test_version_cos7_config_skip(case, tmp_path):
with open(os.path.join(YAML_PATH, "version_cos7_config_simple.yaml")) as fp:
@pytest.mark.parametrize("recipe_version", [0, 1])
def test_version_cos7_config_skip(case, recipe_version, tmp_path):
with open(
os.path.join(YAML_PATHS[recipe_version], "version_cos7_config_simple.yaml")
) as fp:
in_yaml = fp.read()

with open(
os.path.join(YAML_PATH, "version_cos7_config_simple_correct.yaml"),
os.path.join(
YAML_PATHS[recipe_version], "version_cos7_config_simple_correct.yaml"
),
) as fp:
out_yaml = fp.read()

Expand All @@ -88,6 +102,7 @@ def test_version_cos7_config_skip(case, tmp_path):
"version": "0.9",
},
tmp_path=tmp_path,
recipe_version=recipe_version,
)
with open(cfg) as fp:
cfg_lines = fp.readlines()
Expand Down
Loading