| 79 | ) |
| 80 | |
| 81 | async def teardown(self, test_failed: bool = False): |
| 82 | for c in (self._client2, self._client1): |
| 83 | if c: |
| 84 | try: |
| 85 | await c.stop() |
| 86 | except Exception: |
| 87 | pass # Best-effort cleanup during teardown |
| 88 | self._client1 = self._client2 = None |
| 89 | |
| 90 | if self._proxy: |
| 91 | await self._proxy.stop(skip_writing_cache=test_failed) |
| 92 | self._proxy = None |
| 93 | |
| 94 | for d in (self.home_dir, self.work_dir): |
| 95 | if d and os.path.exists(d): |
| 96 | shutil.rmtree(d, ignore_errors=True) |
| 97 | |
| 98 | async def configure_for_test(self, test_file: str, test_name: str): |
| 99 | import re |