# 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
            pool = aredis.ConnectionPool.from_url(
                'rediss://?ssl_cert_reqs=none&ssl_keyfile=test')
            assert e.message == 'certfile should be a valid filesystem path'
            assert pool.get_connection().ssl_context.verify_mode == ssl.CERT_NONE

        with pytest.raises(TypeError) as e:
            pool = aredis.ConnectionPool.from_url(
                'rediss://?ssl_cert_reqs=optional&ssl_keyfile=test')
            assert e.message == 'certfile should be a valid filesystem path'
            assert pool.get_connection().ssl_context.verify_mode == ssl.CERT_OPTIONAL

        with pytest.raises(TypeError) as e:
            pool = aredis.ConnectionPool.from_url(
                'rediss://?ssl_cert_reqs=required&ssl_keyfile=test')
            assert e.message == 'certfile should be a valid filesystem path'
            assert pool.get_connection().ssl_context.verify_mode == ssl.CERT_REQUIRED


class TestConnection:

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_on_connect_error(self, event_loop):
        """
        An error in Connection.on_connect should disconnect from the server
        see for details: https://github.com/andymccurdy/redis-py/issues/368
        """
        # this assumes the Redis server being tested against doesn't have
        # 9999 databases ;)
        bad_connection = aredis.StrictRedis(db=9999, loop=event_loop)
        # an error should be raised on connect

# 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

            pool = aredis.ConnectionPool.from_url(
                'rediss://?ssl_cert_reqs=none&ssl_keyfile=test')
            assert e.message == 'certfile should be a valid filesystem path'
            assert pool.get_connection().ssl_context.verify_mode == ssl.CERT_NONE

        with pytest.raises(TypeError) as e:
            pool = aredis.ConnectionPool.from_url(
                'rediss://?ssl_cert_reqs=optional&ssl_keyfile=test')
            assert e.message == 'certfile should be a valid filesystem path'
            assert pool.get_connection().ssl_context.verify_mode == ssl.CERT_OPTIONAL

        with pytest.raises(TypeError) as e:
            pool = aredis.ConnectionPool.from_url(
                'rediss://?ssl_cert_reqs=required&ssl_keyfile=test')
            assert e.message == 'certfile should be a valid filesystem path'
            assert pool.get_connection().ssl_context.verify_mode == ssl.CERT_REQUIRED


class TestConnection:

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_on_connect_error(self, event_loop):
        """
        An error in Connection.on_connect should disconnect from the server
        see for details: https://github.com/andymccurdy/redis-py/issues/368
        """
        # this assumes the Redis server being tested against doesn't have
        # 9999 databases ;)
        bad_connection = aredis.StrictRedis(db=9999, loop=event_loop)
        # an error should be raised on connect

        with pytest.raises(RedisError):