Пример #1
0
def test_get_version():
    version.VERSION = "3.0.0rc2"

    with mock.patch('subprocess.check_output') as m:
        m.return_value = b"tag-0-cafecafe"
        assert version.get_dev_version() == "3.0.0rc2"

        sys.frozen = True
        assert version.get_dev_version() == "3.0.0rc2 binary"
        sys.frozen = False

        m.return_value = b"tag-2-cafecafe"
        assert version.get_dev_version() == "3.0.0rc2 (+2, commit cafecaf)"

        m.side_effect = subprocess.CalledProcessError(-1, 'git describe --long')
        assert version.get_dev_version() == "3.0.0rc2"
Пример #2
0
def dump_system_info():
    mitmproxy_version = version.get_dev_version()

    data = [
        f"Mitmproxy: {mitmproxy_version}",
        f"Python:    {platform.python_version()}",
        "OpenSSL:   {}".format(SSL.SSLeay_version(SSL.SSLEAY_VERSION).decode()),
        f"Platform:  {platform.platform()}",
    ]
    return "\n".join(data)
Пример #3
0
def dump_system_info():
    mitmproxy_version = version.get_dev_version()

    data = [
        "Mitmproxy: {}".format(mitmproxy_version),
        "Python:    {}".format(platform.python_version()),
        "OpenSSL:   {}".format(SSL.SSLeay_version(SSL.SSLEAY_VERSION).decode()),
        "Platform:  {}".format(platform.platform()),
    ]
    return "\n".join(data)