From: Colin Watson <cjwatson@debian.org>
Date: Mon, 11 Aug 2025 12:16:16 +0100
Subject: Adjust packaging test for Debian's layout

There are no `site-packages` directories in Debian's default `sys.path`,
and multiple `dist-packages` directories.  It seems simplest to just
look up the expected one in `sysconfig`.

Forwarded: not-needed
Last-Update: 2025-08-11
---
 tests/test_packaging.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/tests/test_packaging.py b/tests/test_packaging.py
index 2107b5d..484f1cb 100644
--- a/tests/test_packaging.py
+++ b/tests/test_packaging.py
@@ -1,15 +1,9 @@
-import sys
+import sysconfig
 from pathlib import Path
 
 
 def test_fd_endpoint_plugin_installed():
     # Find the site-packages directory
-    for path in sys.path:
-        if "site-packages" in path:
-            site_packages = Path(path)
-            break
-    else:
-        raise AssertionError("Could not find site-packages in sys.path")
-
+    site_packages = Path(sysconfig.get_path("purelib", "deb_system"))
     plugin_path = site_packages / "twisted" / "plugins" / "fd_endpoint.py"
     assert plugin_path.exists(), f"fd_endpoint.py not found at {plugin_path}"
