Skip to content
Myr

test_help.py

This file

Path

tests/test_help.py

40 lines · 1.2 KiB · Python

Last changed by

Merge pull request #4182 from alexwlchan/idna-versionNate Prewittbefore adoptionfdf4261

History of this file

Take it

1# -*- encoding: utf-823import sys45import pytest67from requests.help import info8910@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6")11def test_system_ssl_py26():12    """OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't13    blow up in this case.14    """15    assert info()['system_ssl'] == {'version': ''}161718@pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+")19def test_system_ssl():20    """Verify we're actually setting system_ssl when it should be available."""21    assert info()['system_ssl']['version'] != ''222324class VersionedPackage(object):25    def __init__(self, version):26        self.__version__ = version272829def test_idna_without_version_attribute(mocker):30    """Older versions of IDNA don't provide a __version__ attribute, verify31    that if we have such a package, we don't blow up.32    """33    mocker.patch('requests.help.idna', new=None)34    assert info()['idna'] == {'version': ''}353637def test_idna_with_version_attribute(mocker):38    """Verify we're actually setting idna version when it should be available."""39    mocker.patch('requests.help.idna', new=VersionedPackage('2.6'))40    assert info()['idna'] == {'version': '2.6'}