From 314623996e87ba57db2af2b0507ff366a95d5b5a Mon Sep 17 00:00:00 2001 From: beckermr Date: Sat, 14 Mar 2026 17:28:21 -0500 Subject: [PATCH 1/4] test: add test for making graph to ensure new nodes are not written --- conda_forge_tick/make_graph.py | 6 ++- environment.yml | 2 +- pyproject.toml | 6 ++- tests/test_make_graph.py | 68 +++++++++++++++++++++++++++++++++- 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/conda_forge_tick/make_graph.py b/conda_forge_tick/make_graph.py index 58fcae393..7d57cbab8 100644 --- a/conda_forge_tick/make_graph.py +++ b/conda_forge_tick/make_graph.py @@ -466,7 +466,11 @@ def main( # we skip new nodes since their data may not be pulled down locally # we will get them eventually once the make graph job has run _migrate_schemas( - [nm for nm in tot_names_for_this_job if nm not in new_names] + [ + nm + for nm in tot_names_for_this_job + if os.path.exists(get_sharded_path(f"node_attrs/{nm}.json")) + ] ) else: _update_graph_nodes( diff --git a/environment.yml b/environment.yml index 420a1ea50..18e42309f 100644 --- a/environment.yml +++ b/environment.yml @@ -66,7 +66,7 @@ dependencies: - wurlitzer - yaml - pip - - pytest <8.1.0 + - pytest =9 - pytest-xprocess - codecov - requests-mock diff --git a/pyproject.toml b/pyproject.toml index 049549c49..c1f69c6c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ packages = {find = {exclude=["tests*", "scripts*", "docs*", "autotick-bot*", "pl package-data = {conda_forge_tick = ["*.xsh", "*.yaml", "*.json"]} package-dir = {conda_forge_tick = "conda_forge_tick"} -[tool.setuptools_scm] +[tool.setuptools-scm] write_to = "conda_forge_tick/_version.py" write_to_template = "__version__ = '{version}'\n" @@ -46,3 +46,7 @@ preview = true [tool.ruff.lint.pycodestyle] max-line-length = 120 + +[tool.pytest] +tmp_path_retention_count = "0" +tmp_path_retention_policy = "none" diff --git a/tests/test_make_graph.py b/tests/test_make_graph.py index cdb6260bf..2dbc81dec 100644 --- a/tests/test_make_graph.py +++ b/tests/test_make_graph.py @@ -1,8 +1,17 @@ +import json + +import networkx as nx import pytest from conftest import HAVE_CONTAINERS_AND_TEST_IMAGE, FakeLazyJson from conda_forge_tick.lazy_json_backends import LazyJson -from conda_forge_tick.make_graph import try_load_feedstock +from conda_forge_tick.make_graph import ( + dump_graph, + load_existing_graph, + try_load_feedstock, +) +from conda_forge_tick.make_graph import main as make_graph_main +from conda_forge_tick.os_utils import pushd @pytest.mark.parametrize("container_enabled", [HAVE_CONTAINERS_AND_TEST_IMAGE, False]) @@ -52,3 +61,60 @@ def test_try_load_feedstock( assert data["url"].startswith("https://github.com/tingerrr/typst-test") assert data["hash_type"] == "sha256" assert isinstance(data["version_pr_info"], LazyJson) + + +@pytest.mark.parametrize( + "kwargs", [{"update_nodes_and_edges": True}, {"schema_migration_only": True}] +) +def test_make_graph_nowrite(tmp_path, kwargs): + with pushd(str(tmp_path)): + (tmp_path / "all_feedstocks.json").write_text( + json.dumps( + { + "active": ["foo", "bar"], + "archived": ["baz"], + } + ) + ) + + with LazyJson("node_attrs/foo.json") as attrs: + attrs.update( + dict( + feedstock_name="foo", + bad=False, + archived=False, + parsing_error=False, + ) + ) + + with LazyJson("node_attrs/baz.json") as attrs: + attrs.update( + dict( + feedstock_name="baz", + bad=False, + archived=True, + parsing_error=False, + ) + ) + + gx = nx.DiGraph() + gx.add_node("foo", payload=LazyJson("node_attrs/foo.json")) + gx.add_node("baz", payload=LazyJson("node_attrs/baz.json")) + dump_graph(gx) + + make_graph_main( + None, + **kwargs, + ) + + fnames = sorted(list(tmp_path.glob("**/*.json"))) + assert not any(fname.name == "bar.json" for fname in fnames), sorted( + fname.relative_to(tmp_path) for fname in fnames + ) + + gx = load_existing_graph() + all_nodes = set(gx.nodes.keys()) + if "update_nodes_and_edges" in kwargs: + assert "bar" in all_nodes, all_nodes + else: + assert "bar" not in all_nodes, all_nodes From e55f5594e69699d2e6e610d92cb2f02352f0e731 Mon Sep 17 00:00:00 2001 From: beckermr Date: Sat, 14 Mar 2026 17:30:44 -0500 Subject: [PATCH 2/4] fix: pyproject.toml is wrong --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c1f69c6c4..e35514647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ packages = {find = {exclude=["tests*", "scripts*", "docs*", "autotick-bot*", "pl package-data = {conda_forge_tick = ["*.xsh", "*.yaml", "*.json"]} package-dir = {conda_forge_tick = "conda_forge_tick"} -[tool.setuptools-scm] +[tool.setuptools_scm] write_to = "conda_forge_tick/_version.py" write_to_template = "__version__ = '{version}'\n" From 9e5915d76fafe80c32d841e2590445c3466f715c Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Sat, 14 Mar 2026 17:32:37 -0500 Subject: [PATCH 3/4] Apply suggestion from @beckermr --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 18e42309f..420a1ea50 100644 --- a/environment.yml +++ b/environment.yml @@ -66,7 +66,7 @@ dependencies: - wurlitzer - yaml - pip - - pytest =9 + - pytest <8.1.0 - pytest-xprocess - codecov - requests-mock From 08420c5bbe7d73fe312a8be99e52093e1c3c27a3 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Sat, 14 Mar 2026 17:38:06 -0500 Subject: [PATCH 4/4] Apply suggestion from @beckermr --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e35514647..049549c49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,3 @@ preview = true [tool.ruff.lint.pycodestyle] max-line-length = 120 - -[tool.pytest] -tmp_path_retention_count = "0" -tmp_path_retention_policy = "none"