From ac6915c002624d233ec14ed5f151a3a516697d7c Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Mon, 20 Feb 2017 10:21:28 +0100 Subject: [PATCH] improve tests --- test/mitmproxy/utils/test_debug.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/mitmproxy/utils/test_debug.py b/test/mitmproxy/utils/test_debug.py index b6d6407cf..4371ef70f 100644 --- a/test/mitmproxy/utils/test_debug.py +++ b/test/mitmproxy/utils/test_debug.py @@ -2,14 +2,19 @@ import io import subprocess import sys from unittest import mock +import pytest from mitmproxy.utils import debug -def test_dump_system_info(): - setattr(sys, 'frozen', True) - assert debug.dump_system_info() +@pytest.mark.parametrize("precompiled", [True, False]) +def test_dump_system_info_precompiled(precompiled): + sys.frozen = None + with mock.patch.object(sys, 'frozen', precompiled): + assert ("Precompiled Binary" in debug.dump_system_info()) == precompiled + +def test_dump_system_info_version(): with mock.patch('subprocess.check_output') as m: m.side_effect = subprocess.CalledProcessError(-1, 'git describe --tags --long') assert 'release version' in debug.dump_system_info()