| 81 | ) |
| 82 | |
| 83 | async def teardown(self, test_failed: bool = False): |
| 84 | if self._client2: |
| 85 | try: |
| 86 | await self._client2.stop() |
| 87 | except Exception: |
| 88 | pass |
| 89 | self._client2 = None |
| 90 | |
| 91 | if self._client1: |
| 92 | try: |
| 93 | await self._client1.stop() |
| 94 | except Exception: |
| 95 | pass |
| 96 | self._client1 = None |
| 97 | |
| 98 | if self._proxy: |
| 99 | await self._proxy.stop(skip_writing_cache=test_failed) |
| 100 | self._proxy = None |
| 101 | |
| 102 | if self.home_dir and os.path.exists(self.home_dir): |
| 103 | shutil.rmtree(self.home_dir, ignore_errors=True) |
| 104 | if self.work_dir and os.path.exists(self.work_dir): |
| 105 | shutil.rmtree(self.work_dir, ignore_errors=True) |
| 106 | |
| 107 | async def configure_for_test(self, test_file: str, test_name: str): |
| 108 | import re |