Skip to content

Commit

Permalink
since /tmp is hardcoded in various config files, hard code it in the …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
joecorall committed Nov 15, 2024
1 parent fb75b6f commit 3c737db
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import tempfile

temp_dir = tempfile.gettempdir()
temp_dir = "/tmp"
output_file_path = os.path.join(temp_dir, "execute_post_action_entity_script.dat")

http_response_body = sys.argv[3]
Expand Down
30 changes: 15 additions & 15 deletions tests/islandora_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def setUp(self):
self.nids = list()
self.output_lines = ""

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_create(self):
create_output = subprocess.check_output(self.create_cmd)
Expand Down Expand Up @@ -203,7 +203,7 @@ def setUp(self):
)
self.update_cmd = ["./workbench", "--config", self.update_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_create(self):
requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -298,7 +298,7 @@ def setUp(self):
)
self.create_cmd = ["./workbench", "--config", self.config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

parser = argparse.ArgumentParser()
parser.add_argument("--config")
Expand Down Expand Up @@ -365,7 +365,7 @@ def setUp(self):
)
self.create_cmd = ["./workbench", "--config", create_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nid_file = os.path.join(self.temp_dir, "workbenchdeletetesttnids.txt")

nids = list()
Expand Down Expand Up @@ -409,7 +409,7 @@ def setUp(self):
)
self.create_cmd = ["./workbench", "--config", self.create_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nid_file = os.path.join(self.temp_dir, "workbenchupdatetestnids.txt")
self.update_metadata_file = os.path.join(
self.current_dir, "assets", "update_test", "workbenchupdatetest.csv"
Expand Down Expand Up @@ -506,7 +506,7 @@ def setUp(self):
config[k] = v
self.islandora_host = config["host"]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nid_file = os.path.join(
self.temp_dir, "workbenchcreatenonlatintestnids.txt"
)
Expand Down Expand Up @@ -594,7 +594,7 @@ def setUp(self):
self.islandora_host = config["host"]

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_secondary_task(self):
requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -698,7 +698,7 @@ def setUp(self):
self.islandora_host = config["host"]

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_secondary_task_with_google_sheet(self):
requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -796,7 +796,7 @@ def setUp(self):
self.islandora_host = config["host"]

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_secondary_task_with_excel(self):
requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -899,7 +899,7 @@ def setUp(self):
create_output = subprocess.check_output(self.create_cmd)
create_output = create_output.decode().strip()

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

self.rollback_file_path = os.path.join(
self.current_dir, "assets", "additional_files_test", "rollback.csv"
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def setUp(self):
self.rollback_file_path = os.path.join(
self.current_dir, "assets", "allow_missing_files_test", "rollback.csv"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

yaml = YAML()
Expand Down Expand Up @@ -1109,7 +1109,7 @@ def setUp(self):
self.rollback_file_path = os.path.join(
self.current_dir, "assets", "allow_missing_files_test", "rollback.csv"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

yaml = YAML()
Expand Down Expand Up @@ -1225,7 +1225,7 @@ def setUp(self):
"allow_missing_files_test",
"add_media_additional_files_allow_missing_files_false.log",
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

yaml = YAML()
Expand Down Expand Up @@ -1393,7 +1393,7 @@ def setUp(self):
"allow_missing_files_test",
"add_media_additional_files_allow_missing_files_true.log",
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

yaml = YAML()
Expand Down Expand Up @@ -1547,7 +1547,7 @@ def setUp(self):
self.islandora_host = config["host"]

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_secondary_task(self):
requests.packages.urllib3.disable_warnings()
Expand Down
44 changes: 22 additions & 22 deletions tests/islandora_tests_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def setUp(self):
config_file_path = os.path.join(
self.current_dir, "assets", "check_test", "update.yml"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
Expand All @@ -113,7 +113,7 @@ def setUp(self):
config_file_path = os.path.join(
self.current_dir, "assets", "check_test", "delete.yml"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
Expand All @@ -139,7 +139,7 @@ def setUp(self):
config_file_path = os.path.join(
self.current_dir, "assets", "check_test", "add_media.yml"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
Expand All @@ -165,7 +165,7 @@ def setUp(self):
config_file_path = os.path.join(
self.current_dir, "assets", "max_node_title_length_test", "create.yml"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
Expand Down Expand Up @@ -225,7 +225,7 @@ def setUp(self):
"--check",
]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_for_too_long_titles(self):
create_output = subprocess.check_output(self.create_cmd)
Expand Down Expand Up @@ -311,7 +311,7 @@ def tearDown(self):
class TestTypedRelationBadRelatorCheck(unittest.TestCase):

def setUp(self):
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_bad_relator_check_fail(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -351,7 +351,7 @@ def tearDown(self):
class TestTypedRelationBadUriCheck(unittest.TestCase):

def setUp(self):
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_bad_uri_check_fail(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -397,7 +397,7 @@ def setUp(self):
cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
self.output = output.decode().strip()
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_new_typed_relation_check(self):
self.assertRegex(self.output, "new terms will be created as noted", "")
Expand All @@ -423,7 +423,7 @@ def tearDown(self):
class TestTypedRelationNoNamespaceCheck(unittest.TestCase):

def setUp(self):
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_no_namespace_check_fail(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -466,7 +466,7 @@ def setUp(self):
cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
self.output = output.decode().strip()
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_delimiter_check(self):
self.assertRegex(self.output, "input data appear to be valid", "")
Expand All @@ -482,7 +482,7 @@ def tearDown(self):
class TestGeolocationCheck(unittest.TestCase):

def setUp(self):
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_geolocation_check(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -508,7 +508,7 @@ def tearDown(self):
class TestHeaderColumnMismatchCheck(unittest.TestCase):

def setUp(self):
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_header_column_mismatch_fail(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -547,7 +547,7 @@ def setUp(self):
cmd = ["./workbench", "--config", config_file_path, "--check"]
output = subprocess.check_output(cmd)
self.output = output.decode().strip()
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_create_with_field_templates_check(self):
self.assertRegex(
Expand All @@ -565,7 +565,7 @@ class TestCommentedCsvs(unittest.TestCase):

def test_commented_csv(self):
current_dir = os.path.dirname(os.path.abspath(__file__))
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

config_file_path = os.path.join(
current_dir, "assets", "commented_csvs_test", "raw_csv.yml"
Expand Down Expand Up @@ -636,7 +636,7 @@ def setUp(self):

self.create_cmd = ["./workbench", "--config", self.taxonomies_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

nids = list()
Expand Down Expand Up @@ -774,7 +774,7 @@ def tearDown(self):
class TestGoogleGid(unittest.TestCase):

def setUp(self):
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_google_gid(self):
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -826,7 +826,7 @@ class TestParentsPrecedeChildren(unittest.TestCase):

def setUp(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_good_csv(self):
config_file_path = os.path.join(
Expand Down Expand Up @@ -860,7 +860,7 @@ class TestCreateAllowMissingFiles(unittest.TestCase):

def setUp(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.false_log_file_path = os.path.join(
self.current_dir,
"assets",
Expand Down Expand Up @@ -978,7 +978,7 @@ class TestCreateAllowMissingFilesWithAdditionalFiles(unittest.TestCase):

def setUp(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.false_log_file_path = os.path.join(
self.current_dir,
"assets",
Expand Down Expand Up @@ -1153,7 +1153,7 @@ def setUp(self):
self.add_media_csv_file_path = os.path.join(
self.current_dir, "assets", "allow_missing_files_test", "add_media.csv"
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

yaml = YAML()
Expand Down Expand Up @@ -1381,7 +1381,7 @@ def setUp(self):
"allow_missing_files_test",
"add_media_additional_files.csv",
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.nids = list()

yaml = YAML()
Expand Down Expand Up @@ -1575,7 +1575,7 @@ def setUp(self):
"csv_row_filters_test",
"csv_row_filters_test.yml",
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.preprocessed_csv_file_path = os.path.join(
self.temp_dir, "csv_row_filters_test.csv.preprocessed"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/islandora_tests_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def setUp(self):
"execute_post_action_entity_script_test",
"script.py",
)
self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"
self.output_file_path = os.path.join(
self.temp_dir, "execute_post_action_entity_script.dat"
)
Expand Down
6 changes: 3 additions & 3 deletions tests/islandora_tests_paged_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def setUp(self):

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_create_paged_content(self):
requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -124,7 +124,7 @@ def setUp(self):

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_create_paged_content_from_directories(self):
requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -233,7 +233,7 @@ def setUp(self):

self.create_cmd = ["./workbench", "--config", self.create_config_file_path]

self.temp_dir = tempfile.gettempdir()
self.temp_dir = "/tmp"

def test_create_paged_content_from_directories(self):
requests.packages.urllib3.disable_warnings()
Expand Down

0 comments on commit 3c737db

Please sign in to comment.