Commit Graph

24 Commits

Author SHA1 Message Date
Maximilian Hils aedbde938a
tests: speedups, lowest-version, ... (#6812) 2024-04-21 23:44:09 +02:00
Maximilian Hils 6e38a56f4c
implement UDP streams (#6557)
based on https://github.com/mitmproxy/mitmproxy_rs/pull/127
2024-01-04 10:53:13 +01:00
Maximilian Hils 244ff35e60
fix usage of `asyncio.create_task` (#5928)
this fixes #5926
2023-02-13 21:45:02 +00:00
autofix-ci[bot] 8c2428c9d3
[autofix.ci] apply automated fixes 2022-11-29 13:28:41 +00:00
Maximilian Hils dc8ff24685 don't remove `add_log` but deprecate it. 2022-09-18 13:45:37 +02:00
Maximilian Hils c69239bb90 switch to stdlib logging
mitmproxy previously used a homegrown logging mechanism based around
`mitmproxy.ctx.log` and the `add_log` hook. This worked well for everything
we control, but does not work outside the mitmproxy universe.
For now we have simply ignored logging in e.g. tornado or h2, but with the
upcoming introduction of mitmproxy_wireguard we now have a dependency
on some Rust/PyO3 code for which we definitely want logs, but which also
cannot easily be changed to use our homegrown logging (PyO3 does the heavy
lifting to add interoperability with stdlib logging). Long story short,
we want to introduce a log handler for stdlib logging.

Now there are two ways how such a handler could operate:

 1. We could build a handler that forwards all stdlib log events
    into our homegrown mechanism.
 2. We embrace stdlib's logging as the correct way to do things,
    and get rid of our homegrown stuff.

This PR follows the second approach by removing the `add_log` hook and
rewriting the `TermLog` and `EventStore` addons to listen for stdlib log records.
This means that all `mitmproxy.ctx.log.info` events are now simply `logging.info` etc.

One upside of this approach is that many parts of the codebase now don't depend
on the existence of `mitmproxy.ctx` and we can use off-the-shelf things like pytest's
`caplog`. We can also now better colorize log output and/or add timestamps.
2022-09-17 17:28:35 +02:00
Maximilian Hils b3587b52b2 make it black! 2022-04-28 19:11:10 +02:00
Thomas Kriechbaumer e6445af2cd cibuild: cleanup outdated providers 2020-12-14 20:01:32 +01:00
Maximilian Hils 01f57346ee sans-io adjustments 2020-12-11 14:09:18 +01:00
Aldo Cortesi 95e690ba31 test: shift test_data out of our public API 2018-04-23 19:16:33 +12:00
Maximilian Hils 4522f15c89 skip ipv6 tests on sudo-enabled travis builds 2017-10-20 16:00:25 +02:00
Thomas Kriechbaumer 4855659eeb nuke old openssl 2017-07-25 10:56:24 +02:00
Thomas Kriechbaumer e77f07a36b cleanup 2017-05-24 14:23:36 +02:00
Thomas Kriechbaumer 0bd3d0ff4c upgrade pytest and remove our pytest.raises wrapper 2017-05-24 11:35:53 +02:00
Thomas Kriechbaumer 24a51df9cb extract full-coverage pytest plugin 2017-02-15 00:29:43 +01:00
Thomas Kriechbaumer d10560d54c improve coverage report 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer 5a3976c43e coverage whitelist -> blacklist 2017-02-09 16:08:36 +01:00
Thomas Kriechbaumer 7a9d40817c pytest.raises: shim new API 2017-02-08 20:04:07 +01:00
Thomas Kriechbaumer 79aa994275 fix merge 2017-02-02 17:26:31 +01:00
Thomas Kriechbaumer 4f0b2bc4de adapt coverage checks 2017-02-02 14:20:56 +01:00
Thomas Kriechbaumer ae008ed80b replace tutils.raises with pytest.raises + shim 2017-02-02 12:59:01 +01:00
Thomas Kriechbaumer ec92d7f67e cleanup test utils 2017-02-02 12:59:01 +01:00
Thomas Kriechbaumer 6e329595ca add test coverage protection 2017-02-02 11:39:33 +01:00
Thomas Kriechbaumer 1a36efbb6a simplify ALPN and OpenSSL on macOS 2016-12-04 11:04:06 +01:00