From 0378c2c780998e7bbba0f2f4f3db281e68f8d981 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 12 Dec 2019 15:00:07 +0000 Subject: [PATCH] Don't hardcode Python versions in test As noted in change If8184c190e76d8cefb5b097f8fa8cb7564207103, the format of an internal error message changed in Python 3. There's no need to manually list each of these versions though - just ensure it's Python 3. Change-Id: Ie1a97d251c6098054bdc963acf53c3182b52b2aa Signed-off-by: Stephen Finucane Closes-Bug: #1855493 --- nova/tests/unit/test_api_validation.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nova/tests/unit/test_api_validation.py b/nova/tests/unit/test_api_validation.py index c71266c3ce..cc5d48c7fc 100644 --- a/nova/tests/unit/test_api_validation.py +++ b/nova/tests/unit/test_api_validation.py @@ -14,7 +14,6 @@ import copy import re -import sys import fixtures from jsonschema import exceptions as jsonschema_exc @@ -444,7 +443,7 @@ class PatternPropertiesTestCase(APIValidationTestCase): # Note(jrosenboom): This is referencing an internal python error # string, which is no stable interface. We need a patch in the # jsonschema library in order to fix this properly. - if sys.version[:3] in ['3.5', '3.6', '3.7']: + if six.PY3: detail = "expected string or bytes-like object" else: detail = "expected string or buffer"