From 2044271c32f75e4dad2e507453657680da4a8444 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 25 Nov 2025 10:45:37 -0700 Subject: [PATCH 1/5] Free butler resources after use --- tests/cqg_test_utils.py | 4 ++-- tests/qg_test_utils.py | 24 ++++++++++++------------ tests/test_pre_transform.py | 6 ++++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/cqg_test_utils.py b/tests/cqg_test_utils.py index 6454c472..997e1fa1 100644 --- a/tests/cqg_test_utils.py +++ b/tests/cqg_test_utils.py @@ -180,8 +180,8 @@ def make_test_clustered_quantum_graph(outdir): cqg : `lsst.ctrl.bps.ClusteredQuantumGraph` Clustered quantum graph. """ - helper = make_test_helper() - qgc = helper.make_quantum_graph_builder(output_run="run").finish(attach_datastore_records=False) + with make_test_helper() as helper: + qgc = helper.make_quantum_graph_builder(output_run="run").finish(attach_datastore_records=False) qg_filename = f"{outdir}/test_file.qg" qgc.write(qg_filename) qgraph = qgc.assemble() diff --git a/tests/qg_test_utils.py b/tests/qg_test_utils.py index b997b434..1e61514d 100644 --- a/tests/qg_test_utils.py +++ b/tests/qg_test_utils.py @@ -334,15 +334,15 @@ def make_test_quantum_graph(run: str = "run", uneven=False): | | | T4(1,2) T4(1,4) T4(3,4) """ - helper = make_test_helper() - qgc = helper.make_quantum_graph_builder(output_run=run).finish(attach_datastore_records=False) - if uneven: - keys_to_drop = {("T1", 1, 2), ("T1", 1, 4), ("T2", 1, 2)} - qgc.quantum_datasets = { - qd.quantum_id: qd - for qd in qgc.quantum_datasets.values() - if (qd.task_label, *qd.data_coordinate) not in keys_to_drop - } - qgc.set_thin_graph() - qgc.set_header_counts() - return qgc.assemble() + with make_test_helper() as helper: + qgc = helper.make_quantum_graph_builder(output_run=run).finish(attach_datastore_records=False) + if uneven: + keys_to_drop = {("T1", 1, 2), ("T1", 1, 4), ("T2", 1, 2)} + qgc.quantum_datasets = { + qd.quantum_id: qd + for qd in qgc.quantum_datasets.values() + if (qd.task_label, *qd.data_coordinate) not in keys_to_drop + } + qgc.set_thin_graph() + qgc.set_header_counts() + return qgc.assemble() diff --git a/tests/test_pre_transform.py b/tests/test_pre_transform.py index ca11ee1a..72515034 100644 --- a/tests/test_pre_transform.py +++ b/tests/test_pre_transform.py @@ -194,7 +194,8 @@ def testValidate(self, mock_validate): "validateClusteredQgraph": True, } config = BpsConfig(settings, search_order=[]) - qgraph = InMemoryRepo().make_quantum_graph() + with InMemoryRepo() as repo: + qgraph = repo.make_quantum_graph() with self.assertRaisesRegex(RuntimeError, "Fake error"): _ = cluster_quanta(config, qgraph, "a_name") @@ -208,7 +209,8 @@ def testNoValidate(self, mock_validate): "validateClusteredQgraph": False, } config = BpsConfig(settings, search_order=[]) - qgraph = InMemoryRepo().make_quantum_graph() + with InMemoryRepo() as repo: + qgraph = repo.make_quantum_graph() _ = cluster_quanta(config, qgraph, "a_name") From 2352ff319873332866f3d764653c94c3d4319b9e Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 25 Nov 2025 10:46:27 -0700 Subject: [PATCH 2/5] Fix ruff usage in pre-commit --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 73546dc1..7ae89b80 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,9 +10,9 @@ repos: - id: check-toml - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.9.6 + rev: v0.13.0 hooks: - - id: ruff + - id: ruff-check args: [--fix] - id: ruff-format - repo: https://github.com/numpy/numpydoc From dc4969bb040c2e7f92cef8570b73798524e771aa Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 25 Nov 2025 10:47:07 -0700 Subject: [PATCH 3/5] Update pre-commit versions --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ae89b80..f598d494 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-yaml args: @@ -16,6 +16,6 @@ repos: args: [--fix] - id: ruff-format - repo: https://github.com/numpy/numpydoc - rev: "v1.8.0" + rev: "v1.9.0" hooks: - id: numpydoc-validation From 36683579cc432ff134bef2b76e5f769c111771bf Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 25 Nov 2025 10:48:48 -0700 Subject: [PATCH 4/5] Ping networkx version for now --- pyproject.toml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8108e9fc..a7282882 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ dependencies = [ "astropy >=4.0", "pyyaml >=5.1", "click >= 7.0", - "networkx", + "networkx <3.6", "lsst-daf-butler", "lsst-pipe-base", "lsst-ctrl-mpexec", diff --git a/requirements.txt b/requirements.txt index b8a2848c..ace78d33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ click astropy -networkx +networkx <3.6 pyyaml lsst-daf-butler @ git+https://github.com/lsst/daf_butler@main lsst-utils @ git+https://github.com/lsst/utils@main From 7cb87b008a3205e7239cbf0d970cdf4cee053fb5 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 25 Nov 2025 13:29:52 -0700 Subject: [PATCH 5/5] Use -Wd for action tests --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ca618911..02dc7155 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -53,7 +53,7 @@ jobs: - name: Run tests run: | - pytest -r a -v -n 3 --cov=lsst.ctrl.bps --cov=tests --cov-report=xml --cov-report=term --cov-branch \ + pytest -Wd -r a -v -n 3 --cov=lsst.ctrl.bps --cov=tests --cov-report=xml --cov-report=term --cov-branch \ --junitxml=junit.xml -o junit_family=legacy - name: Upload coverage to codecov uses: codecov/codecov-action@v5