How to use the redislite.patch.unpatch_redis function in redislite

To help you get started, we’ve selected a few redislite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yahoo / redislite / tests / test_patch.py View on Github external
def test_redislite_double_patch_redis(self):
        original_redis = redis.Redis
        redislite.patch.patch_redis()
        self.assertNotEqual(original_redis, redis.Redis)
        redislite.patch.patch_redis()
        self.assertNotEqual(original_redis, redis.Redis)
        redislite.patch.unpatch_redis()
        self.assertEqual(original_redis, redis.Redis)
github yahoo / redislite / tests / test_patch.py View on Github external
self.tempdir,
            'test_redislite_patch_redis_with_dbfile.db'
        )
        if os.path.exists(dbfilename):
            os.remove(dbfilename)
        redislite.patch.patch_redis(dbfilename)
        r = redis.Redis()
        self._log_redis_pid(r)
        self.assertIsInstance(r.pid, int)    # Should have a redislite pid
        s = redis.Redis()
        self._log_redis_pid(s)
        self.assertIsInstance(r.pid, int)    # Should have a redislite pid

        # Both instances should be talking to the same redis server
        self.assertEqual(r.pid, s.pid)
        redislite.patch.unpatch_redis()

        r._cleanup()
        s._cleanup()
        if os.path.exists(dbfilename):
            os.remove(dbfilename)
github yahoo / redislite / tests / test_patch.py View on Github external
def test_redislite_patch_redis(self):
        redislite.patch.patch_redis()
        r = redis.Redis()
        self._log_redis_pid(r)
        self.assertIsInstance(r.pid, int)    # Should have a redislite pid
        s = redis.StrictRedis()
        self._log_redis_pid(s)
        self.assertIsInstance(s.pid, int)    # Should have a redislite pid
        redislite.patch.unpatch_redis()
github yahoo / redislite / tests / test_patch.py View on Github external
def test_redislite_patch_redis_with_dbfile_in_cwd(self):
        dbfilename = 'test_redislite_patch_redis_with_dbfile_in_cwd.db'
        if os.path.exists(dbfilename):
            os.remove(dbfilename)
        redislite.patch.patch_redis(dbfilename)
        r = redis.Redis()
        self._log_redis_pid(r)
        self.assertIsInstance(r.pid, int)  # Should have a redislite pid
        s = redis.Redis()
        self._log_redis_pid(s)
        self.assertIsInstance(r.pid, int)  # Should have a redislite pid

        # Both instances should be talking to the same redis server
        self.assertEqual(r.pid, s.pid)
        redislite.patch.unpatch_redis()

        r._cleanup()
        s._cleanup()
        if os.path.exists(dbfilename):
            os.remove(dbfilename)