mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
commit
48cfaf8c39
@ -2,14 +2,19 @@ import io
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
import pytest
|
||||||
|
|
||||||
from mitmproxy.utils import debug
|
from mitmproxy.utils import debug
|
||||||
|
|
||||||
|
|
||||||
def test_dump_system_info():
|
@pytest.mark.parametrize("precompiled", [True, False])
|
||||||
setattr(sys, 'frozen', True)
|
def test_dump_system_info_precompiled(precompiled):
|
||||||
assert debug.dump_system_info()
|
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:
|
with mock.patch('subprocess.check_output') as m:
|
||||||
m.side_effect = subprocess.CalledProcessError(-1, 'git describe --tags --long')
|
m.side_effect = subprocess.CalledProcessError(-1, 'git describe --tags --long')
|
||||||
assert 'release version' in debug.dump_system_info()
|
assert 'release version' in debug.dump_system_info()
|
||||||
|
Loading…
Reference in New Issue
Block a user