()
| 47 | |
| 48 | @contextmanager |
| 49 | def create_test_kagglehub_server(): |
| 50 | env = EnvironmentVarGuard() |
| 51 | env.set('KAGGLE_API_ENVIRONMENT', 'TEST') |
| 52 | with env: |
| 53 | endpoint = get_endpoint(get_env()) |
| 54 | test_server_address = urlparse(endpoint) |
| 55 | |
| 56 | with HTTPServer((test_server_address.hostname, test_server_address.port), KaggleAPIHandler) as httpd: |
| 57 | threading.Thread(target=httpd.serve_forever).start() |
| 58 | |
| 59 | try: |
| 60 | yield httpd |
| 61 | finally: |
| 62 | httpd.shutdown() |
| 63 | |
| 64 |
no outgoing calls