You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.8 KiB
37 lines
1.8 KiB
"""Tests for the sys_info module."""
|
|
|
|
import pytest
|
|
from unittest.mock import Mock
|
|
from sys_info import interpreter_info, system_info
|
|
|
|
def test_interpreter_info(mocker):
|
|
"""Test interpreter_info."""
|
|
mocker.patch('subprocess.check_output', return_value='curl output')
|
|
interpreter = Mock()
|
|
interpreter.offline = True
|
|
interpreter.llm.api_base = 'http://api_base'
|
|
interpreter.llm.supports_vision = True
|
|
interpreter.llm.model = 'model'
|
|
interpreter.llm.supports_functions = True
|
|
interpreter.llm.context_window = 'context_window'
|
|
interpreter.llm.max_tokens = 100
|
|
interpreter.auto_run = True
|
|
interpreter.llm.api_base = 'http://api_base'
|
|
interpreter.offline = True
|
|
interpreter.system_message = 'system_message'
|
|
interpreter.messages = [{'content': 'message_content'}]
|
|
result = interpreter_info(interpreter)
|
|
assert 'curl output' in result
|
|
|
|
def test_system_info(mocker):
|
|
"""Test system_info."""
|
|
mocker.patch('your_module.get_oi_version', return_value=('cmd_version', 'pkg_version')) # replace with your actual module name
|
|
mocker.patch('your_module.get_python_version', return_value='python_version') # replace with your actual module name
|
|
mocker.patch('your_module.get_pip_version', return_value='pip_version') # replace with your actual module name
|
|
mocker.patch('your_module.get_os_version', return_value='os_version') # replace with your actual module name
|
|
mocker.patch('your_module.get_cpu_info', return_value='cpu_info') # replace with your actual module name
|
|
mocker.patch('your_module.get_ram_info', return_value='ram_info') # replace with your actual module name
|
|
mocker.patch('your_module.interpreter_info', return_value='interpreter_info') # replace with your actual module name
|
|
interpreter = Mock()
|
|
result = system_info(interpreter)
|
|
assert 'interpreter_info' in result |