From 64f3690367e17056d6839322d2a4f453b6b72fe4 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 9 Jan 2020 14:01:07 -0500 Subject: [PATCH] Reduce duplication in object store integration tests. --- test/integration/objectstore/_base.py | 32 +++++++++++++++++++ test/integration/objectstore/test_jobs.py | 21 ++---------- .../integration/objectstore/test_selection.py | 24 ++------------ 3 files changed, 38 insertions(+), 39 deletions(-) create mode 100644 test/integration/objectstore/_base.py diff --git a/test/integration/objectstore/_base.py b/test/integration/objectstore/_base.py new file mode 100644 index 00000000000..dc1584c9400 --- /dev/null +++ b/test/integration/objectstore/_base.py @@ -0,0 +1,32 @@ +import os +import re + +from galaxy_test.base.populators import ( + DatasetPopulator, +) +from galaxy_test.driver import integration_util + + +class BaseObjectStoreIntegrationTestCase(integration_util.IntegrationTestCase): + + framework_tool_and_types = True + + @classmethod + def _configure_object_store(cls, template, config): + temp_directory = cls._test_driver.mkdtemp() + cls.object_stores_parent = temp_directory + config_path = os.path.join(temp_directory, "object_store_conf.xml") + xml = template.safe_substitute({"temp_directory": temp_directory}) + with open(config_path, "w") as f: + f.write(xml) + config["object_store_config_file"] = config_path + for path in re.findall(r'files_dir path="([^"]*)"', xml): + assert path.startswith(temp_directory) + dir_name = os.path.basename(path) + os.path.join(temp_directory, dir_name) + os.makedirs(path) + setattr(cls, "%s_path" % dir_name, path) + + def setUp(self): + super(BaseObjectStoreIntegrationTestCase, self).setUp() + self.dataset_populator = DatasetPopulator(self.galaxy_interactor) diff --git a/test/integration/objectstore/test_jobs.py b/test/integration/objectstore/test_jobs.py index b53b68a6f5a..2ac6db467e2 100644 --- a/test/integration/objectstore/test_jobs.py +++ b/test/integration/objectstore/test_jobs.py @@ -3,10 +3,7 @@ import os import string -from galaxy_test.base.populators import ( - DatasetPopulator, -) -from galaxy_test.driver import integration_util +from ._base import BaseObjectStoreIntegrationTestCase DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE = string.Template(""" @@ -37,26 +34,14 @@ DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE = string.Template("""