Handle different response of requests.exceptions.RequestException between Py3.6 and 3.8
@@ -17,6 +17,7 @@ import os
import requests
import mock
+import sys
from st2common.content.loader import ContentPackLoader
from st2common.models.db.pack import PackDB
@@ -345,6 +346,14 @@ class PacksControllerTestCase(
def test_index_health_broken(self):
resp = self.app.get("/v1/packs/index/health")
+
+ # up to Py3.6 requests.exceptions.RequestExceptuion() appends a trailing ,
+ if sys.version < (3, 8):
+ broken_index_message = "RequestException('index is broken',)"
+ else:
+ broken_index_message = "RequestException('index is broken')"
+
+ self.maxDiff = None
self.assertEqual(resp.status_int, 200)
self.assertEqual(
resp.json,
@@ -361,7 +370,7 @@ class PacksControllerTestCase(
},
{
"url": "http://broken.example.com",
- "message": "RequestException('index is broken',)",
+ "message": broken_index_message,
"packs": 0,
"error": "unresponsive",
},
