From 76fa1973f71bb7a442184d42d36931db5348d3f8 Mon Sep 17 00:00:00 2001 From: gonfeco Date: Wed, 13 Sep 2023 10:32:48 +0200 Subject: [PATCH] Updating testing stuff --- .github/workflows/python-app.yml | 4 +++- tests/test_btc_01_pl.py | 13 +++++++------ tests/test_btc_02_ae.py | 20 ++++++++++---------- tests/test_btc_03_qpe.py | 9 +++++---- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 80bdb05..b6c418f 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -33,4 +33,6 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python setup.py test + pytest tests/test_btc_01_pl.py + pytest tests/test_btc_02_ae.py + pytest tests/test_btc_03_qpe.py diff --git a/tests/test_btc_01_pl.py b/tests/test_btc_01_pl.py index 4eae734..648817b 100644 --- a/tests/test_btc_01_pl.py +++ b/tests/test_btc_01_pl.py @@ -6,10 +6,11 @@ import re folder = os.getcwd() -folder = re.sub(r"WP3_Benchmark/.*", "WP3_Benchmark/", folder) -folder = folder + "tnbs/BTC_01_PL" -sys.path.append(folder) -from my_benchmark_execution import KERNEL_BENCHMARK +folder = re.sub( + r"WP3_Benchmark/(?=WP3_Benchmark/)*.*","WP3_Benchmark/", folder) + +sys.path.append(folder+"/tnbs/BTC_01_PL") +from my_benchmark_execution import KERNEL_BENCHMARK as PL_CLASS def create_folder(folder_name): @@ -57,7 +58,7 @@ def test_pl(): "pre_save": False, #Saving configuration "save_append" : True, - "saving_folder": "./Results/", + "saving_folder": "Results_PL/", "benchmark_times": "{}_times_benchmark.csv".format(name), "csv_results": "{}_benchmark.csv".format(name), "summary_results": "{}_SummaryResults.csv".format(name), @@ -71,7 +72,7 @@ def test_pl(): benchmark_arguments.update({"kernel_configuration": kernel_configuration}) folder = create_folder(benchmark_arguments["saving_folder"]) - ae_bench = KERNEL_BENCHMARK(**benchmark_arguments) + ae_bench = PL_CLASS(**benchmark_arguments) ae_bench.exe() filename = folder + benchmark_arguments["summary_results"] a = pd.read_csv(filename, header=[0, 1], index_col=[0, 1]) diff --git a/tests/test_btc_02_ae.py b/tests/test_btc_02_ae.py index 4a729ec..d381416 100644 --- a/tests/test_btc_02_ae.py +++ b/tests/test_btc_02_ae.py @@ -6,10 +6,10 @@ import re folder = os.getcwd() -folder = re.sub(r"WP3_Benchmark/.*", "WP3_Benchmark/", folder) -folder = folder + "tnbs/BTC_02_AE" -sys.path.append(folder) -from my_benchmark_execution import KERNEL_BENCHMARK +folder = re.sub( + r"WP3_Benchmark/(?=WP3_Benchmark/)*.*","WP3_Benchmark/", folder) +sys.path.append(folder+"/tnbs/BTC_02_AE") +from my_benchmark_execution import KERNEL_BENCHMARK as AE_CLASS def create_folder(folder_name): @@ -60,7 +60,7 @@ def test_ae_iqae(): "pre_save": True, #Saving configuration "save_append" : True, - "saving_folder": "./Results/", + "saving_folder": "./Results_IQAE/", "benchmark_times": "{}_times_benchmark.csv".format(name), "csv_results": "{}_benchmark.csv".format(name), "summary_results": "{}_SummaryResults.csv".format(name), @@ -76,7 +76,7 @@ def test_ae_iqae(): benchmark_arguments.update({"kernel_configuration": kernel_configuration}) folder = create_folder(benchmark_arguments["saving_folder"]) - ae_bench = KERNEL_BENCHMARK(**benchmark_arguments) + ae_bench = AE_CLASS(**benchmark_arguments) ae_bench.exe() filename = folder + benchmark_arguments["summary_results"] a = pd.read_csv(filename, header=[0, 1], index_col=[0, 1]) @@ -110,7 +110,7 @@ def test_ae_mlae(): "pre_save": True, #Saving configuration "save_append" : True, - "saving_folder": "./Results/", + "saving_folder": "./Results_MLAE/", "benchmark_times": "{}_times_benchmark.csv".format(name), "csv_results": "{}_benchmark.csv".format(name), "summary_results": "{}_SummaryResults.csv".format(name), @@ -126,7 +126,7 @@ def test_ae_mlae(): benchmark_arguments.update({"kernel_configuration": kernel_configuration}) folder = create_folder(benchmark_arguments["saving_folder"]) - ae_bench = KERNEL_BENCHMARK(**benchmark_arguments) + ae_bench = AE_CLASS(**benchmark_arguments) ae_bench.exe() filename = folder + benchmark_arguments["summary_results"] a = pd.read_csv(filename, header=[0, 1], index_col=[0, 1]) @@ -158,7 +158,7 @@ def test_ae_rqae(): "pre_save": True, #Saving configuration "save_append" : True, - "saving_folder": "./Results/", + "saving_folder": "./Results_RQAE/", "benchmark_times": "{}_times_benchmark.csv".format(name), "csv_results": "{}_benchmark.csv".format(name), "summary_results": "{}_SummaryResults.csv".format(name), @@ -174,7 +174,7 @@ def test_ae_rqae(): benchmark_arguments.update({"kernel_configuration": kernel_configuration}) folder = create_folder(benchmark_arguments["saving_folder"]) - ae_bench = KERNEL_BENCHMARK(**benchmark_arguments) + ae_bench = AE_CLASS(**benchmark_arguments) ae_bench.exe() filename = folder + benchmark_arguments["summary_results"] a = pd.read_csv(filename, header=[0, 1], index_col=[0, 1]) diff --git a/tests/test_btc_03_qpe.py b/tests/test_btc_03_qpe.py index d1eaefa..d419962 100644 --- a/tests/test_btc_03_qpe.py +++ b/tests/test_btc_03_qpe.py @@ -6,10 +6,11 @@ import re folder = os.getcwd() -folder = re.sub(r"WP3_Benchmark/.*", "WP3_Benchmark/", folder) -folder = folder + "tnbs/BTC_03_QPE" -sys.path.append(folder) -from my_benchmark_execution import KERNEL_BENCHMARK +folder = os.getcwd() +folder = re.sub( + r"WP3_Benchmark/(?=WP3_Benchmark/)*.*","WP3_Benchmark/", folder) +sys.path.append(folder+"/tnbs/BTC_03_QPE") +from my_benchmark_execution import KERNEL_BENCHMARK def create_folder(folder_name):