From e2157ecdff1a5dedee554908bc71ea3ef9167578 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 20 Jul 2022 17:23:43 +0200 Subject: [PATCH] fix individual_coverage on Windows --- mitmproxy/utils/typecheck.py | 2 +- setup.cfg | 1 + test/individual_coverage.py | 2 ++ test/mitmproxy/addons/test_view.py | 6 ++++++ .../contentviews/test_xml_html_data/test-formatted.html | 1 + test/mitmproxy/contentviews/test_xml_html_data/test.html | 4 ++-- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mitmproxy/utils/typecheck.py b/mitmproxy/utils/typecheck.py index 49ce3b90f..6279cfaeb 100644 --- a/mitmproxy/utils/typecheck.py +++ b/mitmproxy/utils/typecheck.py @@ -3,7 +3,7 @@ from collections import abc try: from types import UnionType -except ImportError: +except ImportError: # pragma: no cover UnionType = object() # type: ignore Type = typing.Union[ diff --git a/setup.cfg b/setup.cfg index 660b9a264..bfa7e08e8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,7 @@ exclude_lines = if typing.TYPE_CHECKING: if TYPE_CHECKING: @overload + @abstractmethod [mypy] ignore_missing_imports = True diff --git a/test/individual_coverage.py b/test/individual_coverage.py index 7c989c385..e3c5ef534 100755 --- a/test/individual_coverage.py +++ b/test/individual_coverage.py @@ -87,6 +87,8 @@ def main(): src_files = [ f for f in src_files if not any(os.path.normpath(p) in f for p in excluded) ] + if len(sys.argv) > 1: + src_files = [f for f in src_files if sys.argv[1] in str(f)] ps = [] for src in sorted(src_files): diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index be0a10022..8f8b7b0e4 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -329,6 +329,12 @@ def test_movement(): v.focus_prev() assert v.focus.index == 0 + v.clear() + v.focus_next() + assert v.focus.index is None + v.focus_prev() + assert v.focus.index is None + def test_duplicate(): v = view.View() diff --git a/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html b/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html index 0eb600048..015043fea 100644 --- a/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html +++ b/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html @@ -40,5 +40,6 @@

esse cillum dolore

eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+ diff --git a/test/mitmproxy/contentviews/test_xml_html_data/test.html b/test/mitmproxy/contentviews/test_xml_html_data/test.html index e74ac3146..645bcaf94 100644 --- a/test/mitmproxy/contentviews/test_xml_html_data/test.html +++ b/test/mitmproxy/contentviews/test_xml_html_data/test.html @@ -9,6 +9,6 @@

Ut enim ad minim

veniam, quis nostrud

exercitation

ullamco laboris

nisi ut aliquip ex ea

commodo consequat.

Duis aute irure

dolor in reprehenderit

in voluptate velit

esse cillum dolore

eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

- + - \ No newline at end of file +