view mrjunejune/inference/sdk_runtime_test.py @ 266:efaf4c63cc94

fix clean production bundle staging Recreate deployment staging before copying the Bazel bundle and verify required inference runtime paths before promoting it. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Fri, 07 Aug 2026 12:52:30 -0700
parents 1f9877b637e9
children
line wrap: on
line source

import asyncio
import os
import sys
import unittest

from copilot import CopilotClient, RuntimeConnection

CLI_PATH = os.path.abspath(sys.argv.pop(1))


class SdkRuntimeTest(unittest.IsolatedAsyncioTestCase):
    async def test_bazel_pinned_cli_starts_without_runtime_download(self) -> None:
        self.assertTrue(os.path.isfile(CLI_PATH))
        self.assertTrue(os.access(CLI_PATH, os.X_OK))

        base_directory = os.path.join(
            os.environ["TEST_TMPDIR"],
            "copilot-home",
        )
        os.makedirs(base_directory)
        client = CopilotClient(
            connection=RuntimeConnection.for_stdio(path=CLI_PATH),
            base_directory=base_directory,
            use_logged_in_user=False,
            log_level="error",
            mode="empty",
        )
        try:
            await asyncio.wait_for(client.start(), timeout=15)
        finally:
            await client.stop()


if __name__ == "__main__":
    unittest.main()