24 lines
822 B
Python
24 lines
822 B
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
from unittest.mock import patch
|
|
|
|
from src.runtime_bootstrap import compute_nofile_target, load_msg_push_exports
|
|
|
|
|
|
class RuntimeBootstrapTests(unittest.TestCase):
|
|
def test_compute_nofile_target_respects_minimum_and_hard_limit(self) -> None:
|
|
self.assertEqual(compute_nofile_target(1024, 524288), 65536)
|
|
self.assertEqual(compute_nofile_target(131072, 65535), 65535)
|
|
|
|
def test_load_msg_push_exports_falls_back_to_noop_when_backup_missing(self) -> None:
|
|
with patch("builtins.__import__", side_effect=ModuleNotFoundError("backup")):
|
|
funcs = load_msg_push_exports()
|
|
self.assertEqual(len(funcs), 7)
|
|
result = funcs[0]("demo")
|
|
self.assertTrue(result["disabled"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|