diff options
author | andy <andy@whiskeymedia.com> | 2012-08-15 23:56:27 -0700 |
---|---|---|
committer | andy <andy@whiskeymedia.com> | 2012-08-15 23:56:27 -0700 |
commit | fd82c5d6cdcc2596b6cf5a0e053658b4c78ee867 (patch) | |
tree | a913c8af4838c9bf67877d181517e934b0953b7d /tests/server_commands.py | |
parent | 2eafadd664fcb5dda0ae9179bd7ca8c422433c10 (diff) | |
download | redis-py-fd82c5d6cdcc2596b6cf5a0e053658b4c78ee867.tar.gz |
make sure tests pass on redis 2.4. merges #271
Diffstat (limited to 'tests/server_commands.py')
-rw-r--r-- | tests/server_commands.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py index 7fb8e79..df92bfb 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -38,12 +38,6 @@ class ServerCommandsTestCase(unittest.TestCase): self.client['b'] = 'bar' self.assertEquals(self.client.dbsize(), 2) - def test_time(self): - first = self.client.time() - time.sleep(0.05) - second = self.client.time() - self.assertLess(first, second) - def test_get_and_set(self): # get and set can't be tested independently of each other client = redis.Redis(host='localhost', port=6379, db=9) @@ -122,6 +116,19 @@ class ServerCommandsTestCase(unittest.TestCase): def test_ping(self): self.assertEquals(self.client.ping(), True) + def test_time(self): + version = self.client.info()['redis_version'] + if StrictVersion(version) < StrictVersion('2.6.0'): + try: + raise unittest.SkipTest() + except AttributeError: + return + + t = self.client.time() + self.assertEquals(len(t), 2) + self.assert_(isinstance(t[0], int)) + self.assert_(isinstance(t[1], int)) + # KEYS def test_append(self): # invalid key type |