From dd1ff39105bfb389e9bae3a5d5a5587cb1c2050f Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Thu, 2 Jul 2015 09:15:39 -0700 Subject: [PATCH] removed import of alternate tap module from unit-tests --- src/bindings/python/flux/kvs.py | 17 +++++++++++++++-- src/bindings/python/test/json_t.py | 1 - src/bindings/python/test/request.py | 1 - 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/bindings/python/flux/kvs.py b/src/bindings/python/flux/kvs.py index e5d9cc3a91d5..2c163078d06e 100644 --- a/src/bindings/python/flux/kvs.py +++ b/src/bindings/python/flux/kvs.py @@ -118,8 +118,21 @@ def __len__(self): - - +@ffi.callback('KVSSetf') +def KVSWatchWrapper(key, value, arg, errnum): + j = Jobj(handle = value) + (cb, real_arg) = ffi.from_handle(arg) + return cb(key, json.loads(j.as_str()), real_arg, errnum) + +kvswatches = {} +def watch(flux_handle, key, fun, arg): + warg = (fun, arg) + kvswatches[key] = warg + return raw.watch(flux_handle, key, KVSWatchWrapper, ffi.new_handle(warg)) + +def unwatch(flux_handle, key): + kvswatches.pop(key, None) + return raw.unwatch(flux_handle, key) diff --git a/src/bindings/python/test/json_t.py b/src/bindings/python/test/json_t.py index 1628b82ed91f..84960233001f 100644 --- a/src/bindings/python/test/json_t.py +++ b/src/bindings/python/test/json_t.py @@ -1,7 +1,6 @@ import unittest import errno from flux.json_c import Jobj -import tap json_str = '{ "a": 42 }' diff --git a/src/bindings/python/test/request.py b/src/bindings/python/test/request.py index 699205f1b6a2..161de7e9a707 100755 --- a/src/bindings/python/test/request.py +++ b/src/bindings/python/test/request.py @@ -2,7 +2,6 @@ import errno import flux.core as core import flux.json_c -import tap json_str = '{"a":42}'; class TestRequestMethods(unittest.TestCase):