standardised naming of test recipe scripts

This commit is contained in:
PatchOfScotland
2023-03-31 11:41:38 +02:00
parent 18d579da22
commit 0c6977ecd3
4 changed files with 20 additions and 14 deletions

5
counting_files.py Normal file
View File

@ -0,0 +1,5 @@
import os
dir_to_count = "."
print(f"There are {len(os.listdir(dir_to_count))} files in the directory.")

View File

@ -136,8 +136,7 @@ class BashHandler(BaseHandler):
JOB_TYPE_BASH,
event,
extras={
JOB_PARAMETERS:yaml_dict,
# CONTROL_SCRIPT:python_job_func
JOB_PARAMETERS:yaml_dict
}
)
print_debug(self._print_target, self.debug_level,

View File

@ -1255,7 +1255,7 @@ COMPLETE_PYTHON_SCRIPT = [
"",
"print('done')"
]
IDMC_UTILS_MODULE = [
IDMC_UTILS_PYTHON_SCRIPT = [
"import matplotlib.pyplot as plt",
"from sklearn import mixture",
"import numpy as np",
@ -1364,7 +1364,7 @@ IDMC_UTILS_MODULE = [
" else:",
" return means, stds, weights"
]
GENERATE_SCRIPT = [
GENERATE_PYTHON_SCRIPT = [
"import numpy as np",
"import random",
"import foam_ct_phantom.foam_ct_phantom as foam_ct_phantom",
@ -1391,7 +1391,9 @@ GENERATE_SCRIPT = [
" np.save(filename, dataset)",
" del dataset"
]
COUNTING_PYTHON_SCRIPT = [
]
valid_pattern_one = FileEventPattern(
"pattern_one", "path_one", "recipe_one", "file_one")

View File

@ -28,8 +28,8 @@ from meow_base.recipes.python_recipe import PythonHandler, PythonRecipe
from shared import TEST_JOB_QUEUE, TEST_JOB_OUTPUT, TEST_MONITOR_BASE, \
MAKER_RECIPE, APPENDING_NOTEBOOK, COMPLETE_PYTHON_SCRIPT, TEST_DIR, \
FILTER_RECIPE, POROSITY_CHECK_NOTEBOOK, SEGMENT_FOAM_NOTEBOOK, \
GENERATOR_NOTEBOOK, FOAM_PORE_ANALYSIS_NOTEBOOK, IDMC_UTILS_MODULE, \
TEST_DATA, GENERATE_SCRIPT, setup, teardown, backup_before_teardown
GENERATOR_NOTEBOOK, FOAM_PORE_ANALYSIS_NOTEBOOK, IDMC_UTILS_PYTHON_SCRIPT, \
TEST_DATA, GENERATE_PYTHON_SCRIPT, setup, teardown, backup_before_teardown
pattern_check = FileEventPattern(
"pattern_check",
@ -1020,11 +1020,11 @@ class MeowTests(unittest.TestCase):
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
make_dir(foam_data_dir)
write_file(lines_to_string(IDMC_UTILS_MODULE),
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
u_spec = importlib.util.spec_from_file_location("gen", gen_path)
gen = importlib.util.module_from_spec(u_spec)
@ -1145,11 +1145,11 @@ class MeowTests(unittest.TestCase):
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
make_dir(foam_data_dir)
write_file(lines_to_string(IDMC_UTILS_MODULE),
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
all_data = [1000] * good + [100] * big + [10000] * small
shuffle(all_data)
@ -1303,11 +1303,11 @@ class MeowTests(unittest.TestCase):
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
make_dir(foam_data_dir)
write_file(lines_to_string(IDMC_UTILS_MODULE),
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
all_data = [1000] * good + [100] * big + [10000] * small
shuffle(all_data)
@ -1455,11 +1455,11 @@ class MeowTests(unittest.TestCase):
foam_data_dir = os.path.join(TEST_MONITOR_BASE, "foam_ct_data")
make_dir(foam_data_dir)
write_file(lines_to_string(IDMC_UTILS_MODULE),
write_file(lines_to_string(IDMC_UTILS_PYTHON_SCRIPT),
os.path.join(TEST_MONITOR_BASE, "idmc_utils_module.py"))
gen_path = os.path.join(TEST_MONITOR_BASE, "generator.py")
write_file(lines_to_string(GENERATE_SCRIPT), gen_path)
write_file(lines_to_string(GENERATE_PYTHON_SCRIPT), gen_path)
all_data = [1000] * good + [100] * big + [10000] * small
shuffle(all_data)