mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
coverage whitelist -> blacklist
This commit is contained in:
parent
f6cea09d5a
commit
5a3976c43e
@ -103,7 +103,7 @@ def pytest_runtestloop(session):
|
||||
measured_files = [os.path.normpath(os.path.relpath(f, prefix)) for f in cov.get_data().measured_files()]
|
||||
measured_files = [f for f in measured_files if not any(f.startswith(excluded_f) for excluded_f in excluded_files)]
|
||||
|
||||
for name in pytest.config.option.full_cov:
|
||||
for name in coverage_values.keys():
|
||||
files = [f for f in measured_files if f.startswith(os.path.normpath(name))]
|
||||
try:
|
||||
with open(os.devnull, 'w') as null:
|
||||
@ -132,12 +132,12 @@ def pytest_terminal_summary(terminalreporter, exitstatus):
|
||||
msg = "FAIL: Full test coverage not reached!\n"
|
||||
terminalreporter.write(msg, **markup)
|
||||
|
||||
for name, value in coverage_values.items():
|
||||
if value < 100:
|
||||
for name in sorted(coverage_values.keys()):
|
||||
if coverage_values[name] < 100:
|
||||
markup = {'red': True, 'bold': True}
|
||||
else:
|
||||
markup = {'green': True}
|
||||
msg = 'Coverage for {}: {:.2f}%\n'.format(name, value)
|
||||
msg = 'Coverage for {}: {:.2f}%\n'.format(name, coverage_values[name])
|
||||
terminalreporter.write(msg, **markup)
|
||||
else:
|
||||
markup = {'green': True}
|
||||
@ -146,5 +146,5 @@ def pytest_terminal_summary(terminalreporter, exitstatus):
|
||||
terminalreporter.write(msg, **markup)
|
||||
|
||||
msg = 'Excluded files:\n'
|
||||
msg += '{}\n'.format('\n'.join(pytest.config.option.no_full_cov))
|
||||
msg += '{}\n'.format('\n'.join(sorted(pytest.config.option.no_full_cov)))
|
||||
terminalreporter.write(msg)
|
||||
|
25
tox.ini
25
tox.ini
@ -12,25 +12,12 @@ setenv = HOME = {envtmpdir}
|
||||
commands =
|
||||
mitmdump --version
|
||||
pytest --timeout 60 --cov-report='' --cov=mitmproxy --cov=pathod \
|
||||
--full-cov=mitmproxy/addons/ \
|
||||
--full-cov=mitmproxy/contentviews/ --no-full-cov=mitmproxy/contentviews/__init__.py --no-full-cov=mitmproxy/contentviews/protobuf.py --no-full-cov=mitmproxy/contentviews/wbxml.py --no-full-cov=mitmproxy/contentviews/xml_html.py \
|
||||
--full-cov=mitmproxy/net/ --no-full-cov=mitmproxy/net/tcp.py --no-full-cov=mitmproxy/net/http/cookies.py --no-full-cov=mitmproxy/net/http/encoding.py --no-full-cov=mitmproxy/net/http/message.py --no-full-cov=mitmproxy/net/http/request.py --no-full-cov=mitmproxy/net/http/response.py --no-full-cov=mitmproxy/net/http/url.py \
|
||||
--full-cov=mitmproxy/proxy/ --no-full-cov=mitmproxy/proxy/protocol/ --no-full-cov=mitmproxy/proxy/config.py --no-full-cov=mitmproxy/proxy/root_context.py --no-full-cov=mitmproxy/proxy/server.py \
|
||||
--full-cov=mitmproxy/script/ \
|
||||
--full-cov=mitmproxy/test/ \
|
||||
--full-cov=mitmproxy/types/ \
|
||||
--full-cov=mitmproxy/utils/ \
|
||||
--full-cov=mitmproxy/__init__.py \
|
||||
--full-cov=mitmproxy/addonmanager.py \
|
||||
--full-cov=mitmproxy/ctx.py \
|
||||
--full-cov=mitmproxy/exceptions.py \
|
||||
--full-cov=mitmproxy/io.py \
|
||||
--full-cov=mitmproxy/log.py \
|
||||
--full-cov=mitmproxy/options.py \
|
||||
--full-cov=mitmproxy/stateobject.py \
|
||||
--full-cov=mitmproxy/version.py \
|
||||
--full-cov=mitmproxy/tcp.py \
|
||||
--full-cov=mitmproxy/websocket.py \
|
||||
--full-cov=mitmproxy/ \
|
||||
--no-full-cov=mitmproxy/contentviews/__init__.py --no-full-cov=mitmproxy/contentviews/protobuf.py --no-full-cov=mitmproxy/contentviews/wbxml.py --no-full-cov=mitmproxy/contentviews/xml_html.py \
|
||||
--no-full-cov=mitmproxy/net/tcp.py --no-full-cov=mitmproxy/net/http/cookies.py --no-full-cov=mitmproxy/net/http/encoding.py --no-full-cov=mitmproxy/net/http/message.py --no-full-cov=mitmproxy/net/http/request.py --no-full-cov=mitmproxy/net/http/response.py --no-full-cov=mitmproxy/net/http/url.py \
|
||||
--no-full-cov=mitmproxy/proxy/protocol/ --no-full-cov=mitmproxy/proxy/config.py --no-full-cov=mitmproxy/proxy/root_context.py --no-full-cov=mitmproxy/proxy/server.py \
|
||||
--no-full-cov=mitmproxy/tools/ \
|
||||
--no-full-cov=mitmproxy/certs.py --no-full-cov=mitmproxy/connections.py --no-full-cov=mitmproxy/controller.py --no-full-cov=mitmproxy/events.py --no-full-cov=mitmproxy/export.py --no-full-cov=mitmproxy/flow.py --no-full-cov=mitmproxy/flowfilter.py --no-full-cov=mitmproxy/http.py --no-full-cov=mitmproxy/io_compat.py --no-full-cov=mitmproxy/master.py --no-full-cov=mitmproxy/optmanager.py \
|
||||
--full-cov=pathod/ --no-full-cov=pathod/pathoc.py --no-full-cov=pathod/pathod.py --no-full-cov=pathod/test.py --no-full-cov=pathod/protocols/http2.py \
|
||||
{posargs}
|
||||
{env:CI_COMMANDS:python -c ""}
|
||||
|
Loading…
Reference in New Issue
Block a user