MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / test_check_env

Function test_check_env

tests/test_main.py:52–67  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

50
51
52def test_check_env(monkeypatch):
53 version_info_correct = _version_info(3, 10)
54 version_info_wrong = _version_info(3, 9)
55 monkeypatch.setattr(sys, "version_info", version_info_correct)
56 with mock.patch("os.makedirs") as mock_makedirs:
57 check_env()
58 # check_env uses get_astrbot_*_path() which returns absolute paths,
59 # so just verify makedirs was called the expected number of times
60 assert mock_makedirs.call_count >= 4
61 # Verify all calls used exist_ok=True
62 for call_args in mock_makedirs.call_args_list:
63 assert call_args[1].get("exist_ok") is True
64
65 monkeypatch.setattr(sys, "version_info", version_info_wrong)
66 with pytest.raises(SystemExit):
67 check_env()
68
69
70def test_apply_startup_env_flags_sets_reset_password_env(monkeypatch):

Callers

nothing calls this directly

Calls 4

check_envFunction · 0.90
_version_infoClass · 0.85
patchMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected