'If I{service_identity} cannot be imported then
L{_selectVerifyImplementation} emits a L{UserWarning} advising the user
of the exact error.'

def test_dependencyMissingWarning(self):

    with SetAsideModule('service_identity'):
        sys.modules['service_identity'] = None
        sslverify._selectVerifyImplementation()
    [warning] = list((warning for warning in self.flushWarnings() if (warning['category'] == UserWarning)))
    if _PY3:
        importError = "'import    of    'service_identity'    halted;    None    in    sys.modules'"
    else:
        importError = "'No    module    named    service_identity'"
    expectedMessage = 'You    do    not    have    a    working    installation    of    the    service_identity    module:    {message}.        Please    install    it    from    <https://pypi.python.org/pypi/service_identity>    and    make    sure    all    of    its    dependencies    are    satisfied.        Without    the    service_identity    module,    Twisted    can    perform    only    rudimentary    TLS    client    hostname    verification.        Many    valid    certificate/hostname    mappings    may    be    rejected.'.format(message=importError)
    self.assertEqual((warning['message'], warning['filename'], warning['lineno']), (expectedMessage, '', 0))
