From 39428e9673d26fdd8c1a5f1c3e4f25e3faf19c39 Mon Sep 17 00:00:00 2001 From: Elton Cardoso do Nascimento <43186596+EltonCN@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:57:32 -0300 Subject: [PATCH] MS example test skip if no Redis --- tests/examples/test_memory_storage.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/examples/test_memory_storage.py b/tests/examples/test_memory_storage.py index 9aea827..9bb19cb 100644 --- a/tests/examples/test_memory_storage.py +++ b/tests/examples/test_memory_storage.py @@ -1,6 +1,8 @@ import os import re +import redis +import unittest from testbook import testbook from testbook.client import TestbookNotebookClient @@ -10,9 +12,16 @@ examples_path = get_examples_path() else: - examples_path = "examples" +client = redis.Redis(decode_responses=True) +try: + client.ping() + redis_reachable = True +except Exception: + redis_reachable = False + +@unittest.skipIf(not redis_reachable, "Redis server not running") @testbook(os.path.join(examples_path, "Memory Storage.ipynb"), execute=True) def test_gym_integration(tb :TestbookNotebookClient):