From a6061f1d12f737ef7b97bd2b03cbbe7a45ad0110 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Wed, 6 Sep 2023 16:47:12 -0500 Subject: [PATCH] Skip tests if tensorflow not available --- foqus_lib/gui/tests/test_surrogate.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/foqus_lib/gui/tests/test_surrogate.py b/foqus_lib/gui/tests/test_surrogate.py index 9f88f2d36..16eef30e2 100644 --- a/foqus_lib/gui/tests/test_surrogate.py +++ b/foqus_lib/gui/tests/test_surrogate.py @@ -18,6 +18,14 @@ import pytest +try: + import tensorflow +except ModuleNotFoundError: + tensorflow_available = False +else: + tensorflow_available = True + + pytestmark = pytest.mark.gui @@ -52,6 +60,7 @@ class TestFrame: # # "ACOSSO", # ] # ) + @pytest.mark.skipif(not tensorflow_available, reason="tensorflow not available") def test_run_surrogate( self, qtbot, frame, main_window: mainWindow, name: str = "keras_nn" ):