From 2738aaadfd49d974c544c5f99b3bc910792e6968 Mon Sep 17 00:00:00 2001 From: Panagiotis Anagnostou Date: Mon, 9 Mar 2026 15:53:16 +0200 Subject: [PATCH 1/4] pytest fixes for better Cl environment integration --- tests/conftest.py | 11 +++++++++++ tests/test_package.py | 16 ++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..f606c9a --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,11 @@ +import os + + +def pytest_configure(): + # Force a non-interactive backend so CI can render plots without Tk. + os.environ.setdefault("MPLBACKEND", "Agg") + import matplotlib + + if matplotlib.get_backend().lower() != "agg": + matplotlib.use("Agg", force=True) + diff --git a/tests/test_package.py b/tests/test_package.py index 876ca8b..ef76242 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -64,7 +64,7 @@ def test_pddp_return_type(datadir): assert isinstance(new_obj, PDDP) -def test_bicecting_kmeans_return_type(datadir): +def test_bisecting_kmeans_return_type(datadir): with open(datadir.join('test_data.dump'), "rb") as inf: data_import = pickle.load(inf) @@ -181,7 +181,7 @@ def test_pddp_parameter_errors(datadir): assert success_score == 13 -def test_bicecting_kmeans_parameter_errors(): +def test_bisecting_kmeans_parameter_errors(): success_score = 0 algorithm = BisectingKmeans(random_state=5) @@ -256,7 +256,7 @@ def test_pddp_labels__return_type_and_form(datadir): assert isinstance(results, np.ndarray) and results.ndim == 1 -def test_bicecting_kmeans_labels_return_type_and_form(datadir): +def test_bisecting_kmeans_labels_return_type_and_form(datadir): with open(datadir.join('test_data.dump'), "rb") as inf: data_import = pickle.load(inf) @@ -755,7 +755,7 @@ def test_split_visualization_plot_9(datadir): assert False -def test_split_visualization_typeerror(datadir): +def test_split_visualization_type_error(): try: viz.split_visualization(np.array([1, 2, 3])) assert False @@ -763,7 +763,7 @@ def test_split_visualization_typeerror(datadir): assert True -def test_split_visualization_valueerror_1(datadir): +def test_split_visualization_value_error_1(datadir): with open(datadir.join('test_data.dump'), "rb") as inf: data_import = pickle.load(inf) @@ -779,7 +779,7 @@ def test_split_visualization_valueerror_1(datadir): assert True -def test_split_visualization_valueerror_2(datadir): +def test_split_visualization_value_error_2(datadir): with open(datadir.join('test_data.dump'), "rb") as inf: data_import = pickle.load(inf) @@ -816,7 +816,7 @@ def test_dendrogram_visualization(datadir): assert success_score == 3 -def test_dendrogram_visualization_typeerror(datadir): +def test_dendrogram_visualization_type_error(datadir): with open(datadir.join('test_data.dump'), "rb") as inf: data_import = pickle.load(inf) @@ -863,7 +863,7 @@ def test_create_linkage(datadir): assert success_score == 2 -def test_linkage_typeerror(datadir): +def test_linkage_type_error(): try: viz.linkage(np.array([1, 2, 3])) assert False From e39f32b47852acdc7aa2a3f7ce84759c26b3a471 Mon Sep 17 00:00:00 2001 From: Panagiotis Anagnostou Date: Mon, 9 Mar 2026 16:04:29 +0200 Subject: [PATCH 2/4] PEP8 assurance fixes Signed-off-by: Panagiotis Anagnostou --- tests/test_package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_package.py b/tests/test_package.py index ef76242..1eeef88 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -816,6 +816,7 @@ def test_dendrogram_visualization(datadir): assert success_score == 3 + def test_dendrogram_visualization_type_error(datadir): with open(datadir.join('test_data.dump'), "rb") as inf: data_import = pickle.load(inf) From 645ee41b93381c32b4d74105f5630c90adaa9772 Mon Sep 17 00:00:00 2001 From: Panagiotis Anagnostou Date: Mon, 9 Mar 2026 16:06:28 +0200 Subject: [PATCH 3/4] PEP8 assurance fixes Signed-off-by: Panagiotis Anagnostou --- tests/test_package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_package.py b/tests/test_package.py index 1eeef88..25c878a 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -612,7 +612,7 @@ def test_ipddp_tsne_results(datadir): data_import = pickle.load(inf) try: - out_matrix = IPDDP( + _ = IPDDP( decomposition_method="tsne", max_clusters_number=3, random_state=0, From 7e4b7a2802ed9876951b60d644a7f2d17e3957a1 Mon Sep 17 00:00:00 2001 From: Panagiotis Anagnostou Date: Mon, 9 Mar 2026 16:06:48 +0200 Subject: [PATCH 4/4] PEP8 assurance fixes Signed-off-by: Panagiotis Anagnostou --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index f606c9a..f2c3895 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,4 +8,3 @@ def pytest_configure(): if matplotlib.get_backend().lower() != "agg": matplotlib.use("Agg", force=True) -