(self, module)
| 36 | cleanup() |
| 37 | |
| 38 | def warp_into_web(self, module): |
| 39 | client = None |
| 40 | for _ in range(5): |
| 41 | try: |
| 42 | port = random.randint(10000, 30000) |
| 43 | web = lazyllm.WebModule(module, port=port) |
| 44 | web._work() |
| 45 | time.sleep(2) |
| 46 | except AssertionError as e: |
| 47 | # Port is occupied |
| 48 | if 'occupied' in e: |
| 49 | continue |
| 50 | else: |
| 51 | raise e |
| 52 | try: |
| 53 | client = Client(web.url, download_files=web.cach_path) |
| 54 | break |
| 55 | except httpx.ConnectError: |
| 56 | continue |
| 57 | assert client, 'Unable to create client' |
| 58 | self.webs.append(web) |
| 59 | self.clients.append(client) |
| 60 | return web, client |
| 61 | |
| 62 | def test_chat(self): |
| 63 | from examples.chatbot import chat |
no test coverage detected