Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_redislite_patch_redis_StrictRedis(self):
redislite.patch.patch_redis_StrictRedis()
r = redis.StrictRedis()
self._log_redis_pid(r)
self.assertIsInstance(r.pid, int) # Should have a redislite pid
redislite.patch.unpatch_redis_StrictRedis()
self.tempdir,
'test_redislite_patch_redis_with_short_dbfile.db'
)
if os.path.exists(dbfilename):
os.remove(dbfilename)
redislite.patch.patch_redis_StrictRedis(dbfilename)
r = redis.StrictRedis()
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(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_StrictRedis()
r._cleanup()
s._cleanup()
if os.path.exists(dbfilename):
os.remove(dbfilename)