From 90264452030406fa70585a6060d09c1bd7ef70f1 Mon Sep 17 00:00:00 2001 From: YASHAS Date: Wed, 8 Jul 2026 17:52:45 +0530 Subject: [PATCH] tests: fix hardcoded skip in test_import_from_url Replace skipif(True, ...) with a runtime check that detects whether tests are running inside a Docker container by checking for /.dockerenv. This allows the test to run normally outside containers while still skipping inside them where the temporary HTTP server is unreachable. Relates to moby/moby#52754 Signed-off-by: YASHAS --- tests/integration/api_image_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/api_image_test.py b/tests/integration/api_image_test.py index d3915c9b51..cf5cc5eff4 100644 --- a/tests/integration/api_image_test.py +++ b/tests/integration/api_image_test.py @@ -1,5 +1,6 @@ import contextlib import json +import os import shutil import socket import socketserver @@ -278,7 +279,11 @@ def do_GET(self): server.shutdown() - @pytest.mark.skipif(True, reason="Doesn't work inside a container - FIXME") + @pytest.mark.skipif( + os.environ.get('DOCKER_HOST', '').startswith('unix:///') and + os.path.exists('/.dockerenv'), + reason="Doesn't work inside a container - HTTP server unreachable from within Docker" +) def test_import_from_url(self): # The crappy test HTTP server doesn't handle large files well, so use # a small file.