mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
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 = <integration.test_job_files.TestJobFilesIntegration object at 0x73c52a002260>
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'
```
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user