From 1a1d7265a58b180d4eb97667619ffd73ec5b4d50 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 7 Jul 2026 02:48:44 +0100 Subject: [PATCH] Fix ``TestJobFilesIntegration`` initialization `input_hda_dict` and `input_hda` are initialized once for all tests in the class, i.e. they needed to be class attributes. Fix the following error when running all tests in the class with `./run_tests.sh -integration test/integration/test_job_files.py`: ``` self = def test_read_fails_if_input_file_purged(self): job, _, _ = self.create_static_job_with_state("running") job_id, job_key = self._api_job_keys(job) > input_file_path = self.input_hda.get_file_name() E AttributeError: 'TestJobFilesIntegration' object has no attribute 'input_hda' ``` --- test/integration/test_job_files.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/integration/test_job_files.py b/test/integration/test_job_files.py index 0b5fe23df38..1ed7bd5ccd3 100644 --- a/test/integration/test_job_files.py +++ b/test/integration/test_job_files.py @@ -18,6 +18,7 @@ API has gone too far. import io import os import tempfile +from typing import Any import requests from sqlalchemy import select @@ -40,6 +41,8 @@ TEST_TUS_CHUNK_SIZE = 1024 class TestJobFilesIntegration(integration_util.IntegrationTestCase): initialized = False dataset_populator: DatasetPopulator + input_hda_dict: dict[str, Any] + input_hda: model.HistoryDatasetAssociation @classmethod def handle_galaxy_config_kwds(cls, config): @@ -57,9 +60,11 @@ class TestJobFilesIntegration(integration_util.IntegrationTestCase): sa_session = self.sa_session stmt = select(model.HistoryDatasetAssociation) assert len(sa_session.scalars(stmt).all()) == 0 - self.input_hda_dict = self.dataset_populator.new_dataset(history_id, content=TEST_INPUT_TEXT, wait=True) + TestJobFilesIntegration.input_hda_dict = self.dataset_populator.new_dataset( + history_id, content=TEST_INPUT_TEXT, wait=True + ) assert len(sa_session.scalars(stmt).all()) == 1 - self.input_hda = sa_session.scalars(stmt).all()[0] + TestJobFilesIntegration.input_hda = sa_session.scalars(stmt).all()[0] TestJobFilesIntegration.initialized = True def test_read_by_state(self):