--- a/Tests/test_file_webp.py
+++ b/Tests/test_file_webp.py
@@ -19,6 +19,8 @@ from .helper import (
     skip_unless_feature,
 )
 
+import os
+
 try:
     from PIL import _webp
 
@@ -67,7 +69,11 @@ class TestFileWebp:
 
             # generated with:
             # dwebp -ppm ../../Tests/images/hopper.webp -o hopper_webp_bits.ppm
-            assert_image_similar_tofile(image, "Tests/images/hopper_webp_bits.ppm", 1.0)
+            if 'ADTTMP' in os.environ:
+                target_file = os.path.join(os.environ['ADTTMP'], 'hopper_webp.ppm')
+            else:
+                target_file = 'Tests/images/hopper_webp_bits.ppm'
+            assert_image_similar_tofile(image, target_file, 1.0)
 
     def _roundtrip(
         self, tmp_path: Path, mode: str, epsilon: float, args: dict[str, Any] = {}
