2017-01-23 21:53:56 +00:00
|
|
|
import os
|
2016-12-01 09:36:18 +00:00
|
|
|
import pytest
|
|
|
|
import OpenSSL
|
2017-02-01 15:48:46 +00:00
|
|
|
import functools
|
2017-02-06 16:48:44 +00:00
|
|
|
from contextlib import contextmanager
|
2017-01-23 21:53:56 +00:00
|
|
|
|
2016-12-01 09:36:18 +00:00
|
|
|
import mitmproxy.net.tcp
|
|
|
|
|
2017-02-14 23:27:14 +00:00
|
|
|
pytest_plugins = ('test.full_coverage_plugin',)
|
2016-12-01 09:36:18 +00:00
|
|
|
|
|
|
|
requires_alpn = pytest.mark.skipif(
|
|
|
|
not mitmproxy.net.tcp.HAS_ALPN,
|
|
|
|
reason='requires OpenSSL with ALPN support')
|
|
|
|
|
2017-02-01 15:17:22 +00:00
|
|
|
skip_windows = pytest.mark.skipif(
|
|
|
|
os.name == "nt",
|
|
|
|
reason='Skipping due to Windows'
|
|
|
|
)
|
|
|
|
|
|
|
|
skip_not_windows = pytest.mark.skipif(
|
|
|
|
os.name != "nt",
|
|
|
|
reason='Skipping due to not Windows'
|
|
|
|
)
|
|
|
|
|
|
|
|
skip_appveyor = pytest.mark.skipif(
|
|
|
|
"APPVEYOR" in os.environ,
|
|
|
|
reason='Skipping due to Appveyor'
|
|
|
|
)
|
|
|
|
|
2016-12-01 09:36:18 +00:00
|
|
|
|
2017-02-14 23:27:14 +00:00
|
|
|
@pytest.fixture()
|
|
|
|
def disable_alpn(monkeypatch):
|
|
|
|
monkeypatch.setattr(mitmproxy.net.tcp, 'HAS_ALPN', False)
|
|
|
|
monkeypatch.setattr(OpenSSL.SSL._lib, 'Cryptography_HAS_ALPN', False)
|