From 87cd5598476d0835c526918a9e1f03fe2d698866 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 24 Nov 2013 20:24:45 -0600 Subject: [PATCH] Account for a platform difference in semaphores On OS X (and probably other Operating Systems) it isn't possible to introspect the value of a semaphore. Account for this by skipping a test about this. Change-Id: I97824f9fc4e36de4f7a62c8ce53865e6977dfdfe --- test/unit/obj/test_server.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py index 0833146376..fdfa6c25a2 100755 --- a/test/unit/obj/test_server.py +++ b/test/unit/obj/test_server.py @@ -27,7 +27,10 @@ from time import gmtime, strftime, time from tempfile import mkdtemp from hashlib import md5 -from eventlet import sleep, spawn, wsgi, listen, Timeout +from eventlet import sleep, spawn, wsgi, listen, Timeout, tpool + +from nose import SkipTest + from test.unit import FakeLogger, debug_logger from test.unit import connect_tcp, readuntil2crlfs from swift.obj import server as object_server @@ -36,7 +39,6 @@ from swift.common import utils from swift.common.utils import hash_path, mkdirs, normalize_timestamp, \ NullLogger, storage_directory, public, replication from swift.common import constraints -from eventlet import tpool from swift.common.swob import Request, HeaderKeyDict @@ -2826,8 +2828,14 @@ class TestObjectController(unittest.TestCase): object_server.global_conf_callback(preloaded_app_conf, global_conf) self.assertEqual(preloaded_app_conf, {}) self.assertEqual(global_conf.keys(), ['replication_semaphore']) - self.assertEqual( - global_conf['replication_semaphore'][0].get_value(), 4) + try: + value = global_conf['replication_semaphore'][0].get_value() + except NotImplementedError: + # On some operating systems (at a minimum, OS X) it's not possible + # to introspect the value of a semaphore + raise SkipTest + else: + self.assertEqual(value, 4) def test_global_conf_callback_replication_semaphore(self): preloaded_app_conf = {'replication_concurrency': 123}