# Path: aredis/pool.py
# def to_bool(value):
#     if value is None or value == '':
#         return None
#     if isinstance(value, str) and value.upper() in FALSE_STRINGS:
#         return False
#     return bool(value)
# 
# Path: aredis/exceptions.py
# class ConnectionError(RedisError):
#     pass
# 
# class RedisError(Exception):
#     pass
# 
# class BusyLoadingError(ConnectionError):
#     pass
# 
# class ReadOnlyError(ResponseError):
#     pass
# 
# Path: tests/client/conftest.py
# def skip_if_server_version_lt(min_version):
#     loop = asyncio.get_event_loop()
#     version = StrictVersion(loop.run_until_complete(get_version()))
#     check = version < StrictVersion(min_version)
#     return pytest.mark.skipif(check, reason="")


import os
import pytest
import aredis
import re
import asyncio
        import warnings
        import ssl
from aredis.pool import to_bool
from aredis.exceptions import (ConnectionError, RedisError,
                               BusyLoadingError, ReadOnlyError)
from .conftest import skip_if_server_version_lt
        # 9999 databases ;)
        bad_connection = aredis.StrictRedis(db=9999, loop=event_loop)
        # an error should be raised on connect
        with pytest.raises(RedisError):
            await bad_connection.info()
        pool = bad_connection.connection_pool
        assert len(pool._available_connections) == 0

    @skip_if_server_version_lt('2.8.8')
    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_busy_loading_disconnects_socket(self, event_loop):
        """
        If Redis raises a LOADING error, the connection should be
        disconnected and a BusyLoadingError raised
        """
        client = aredis.StrictRedis(loop=event_loop)
        with pytest.raises(BusyLoadingError):
            await client.execute_command('DEBUG', 'ERROR', 'LOADING fake message')
        pool = client.connection_pool
        assert len(pool._available_connections) == 0

    @skip_if_server_version_lt('2.8.8')
    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_busy_loading_from_pipeline_immediate_command(self, event_loop):
        """
        BusyLoadingErrors should raise from Pipelines that execute a
        command immediately, like WATCH does.
        """
        client = aredis.StrictRedis(loop=event_loop)
        pipe = await client.pipeline()

# Path: aredis/pool.py
# def to_bool(value):
#     if value is None or value == '':
#         return None
#     if isinstance(value, str) and value.upper() in FALSE_STRINGS:
#         return False
#     return bool(value)
# 
# Path: aredis/exceptions.py
# class ConnectionError(RedisError):
#     pass
# 
# class RedisError(Exception):
#     pass
# 
# class BusyLoadingError(ConnectionError):
#     pass
# 
# class ReadOnlyError(ResponseError):
#     pass
# 
# Path: tests/client/conftest.py
# def skip_if_server_version_lt(min_version):
#     loop = asyncio.get_event_loop()
#     version = StrictVersion(loop.run_until_complete(get_version()))
#     check = version < StrictVersion(min_version)
#     return pytest.mark.skipif(check, reason="")


# Path: tests/client/test_connection_pool.py
import os
import pytest
import aredis
import re
import asyncio
        import warnings
        import ssl
from aredis.pool import to_bool
from aredis.exceptions import (ConnectionError, RedisError,
                               BusyLoadingError, ReadOnlyError)
from .conftest import skip_if_server_version_lt

        # 9999 databases ;)
        bad_connection = aredis.StrictRedis(db=9999, loop=event_loop)
        # an error should be raised on connect
        with pytest.raises(RedisError):
            await bad_connection.info()
        pool = bad_connection.connection_pool
        assert len(pool._available_connections) == 0

    @skip_if_server_version_lt('2.8.8')
    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_busy_loading_disconnects_socket(self, event_loop):
        """
        If Redis raises a LOADING error, the connection should be
        disconnected and a BusyLoadingError raised
        """
        client = aredis.StrictRedis(loop=event_loop)
        with pytest.raises(BusyLoadingError):
            await client.execute_command('DEBUG', 'ERROR', 'LOADING fake message')
        pool = client.connection_pool
        assert len(pool._available_connections) == 0

    @skip_if_server_version_lt('2.8.8')
    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_busy_loading_from_pipeline_immediate_command(self, event_loop):
        """
        BusyLoadingErrors should raise from Pipelines that execute a
        command immediately, like WATCH does.
        """
        client = aredis.StrictRedis(loop=event_loop)
        pipe = await client.pipeline()

        with pytest.raises(BusyLoadingError):