From 67fe8f85b8248057f008c0f2efde83ae1370b190 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 28 Mar 2024 17:16:21 +0100 Subject: [PATCH] fix tests, etc --- scenarios/generator_2p1.py | 12 +----------- scenarios/utils.py | 12 ++++++++++++ tests/utils.py | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 scenarios/utils.py diff --git a/scenarios/generator_2p1.py b/scenarios/generator_2p1.py index af2d46b..644470f 100644 --- a/scenarios/generator_2p1.py +++ b/scenarios/generator_2p1.py @@ -1,9 +1,8 @@ -import os, sys import copy import yaml -import glob from scenarios.presets import column_presets +from scenarios.utils import recreate_dir default_config = { @@ -23,15 +22,6 @@ } } -def recreate_dir(save_dir): - if not os.path.exists(save_dir): - os.makedirs(save_dir) - print(f"Directory {save_dir} created.") - else: - print(f"Directory {save_dir} already exists, will clean all YAML files from it.") - yaml_files = glob.glob(f"{save_dir}/*yaml")+glob.glob(f"{save_dir}/*yml") - for file in yaml_files: - os.remove(file) def generate_configs(save_dir="./"): recreate_dir(save_dir) diff --git a/scenarios/utils.py b/scenarios/utils.py new file mode 100644 index 0000000..874dffc --- /dev/null +++ b/scenarios/utils.py @@ -0,0 +1,12 @@ +import os +import glob + +def recreate_dir(save_dir): + if not os.path.exists(save_dir): + os.makedirs(save_dir) + print(f"Directory {save_dir} created.") + else: + print(f"Directory {save_dir} already exists, will clean all YAML files from it.") + yaml_files = glob.glob(f"{save_dir}/*yaml")+glob.glob(f"{save_dir}/*yml") + for file in yaml_files: + os.remove(file) \ No newline at end of file diff --git a/tests/utils.py b/tests/utils.py index e160f01..4f268fb 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,7 +1,7 @@ import os, sys sys.path.append(os.getcwd()) import copy -from benchmark import Benchmark +from src.benchmark import Benchmark def run_tests(config, functions): b = Benchmark(config)