Issue #25800: Fix running test_capi directly
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 36c62376..a0c1e79 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -257,7 +257,8 @@
 
 class EmbeddingTests(unittest.TestCase):
     def setUp(self):
-        basepath = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+        here = os.path.abspath(__file__)
+        basepath = os.path.dirname(os.path.dirname(os.path.dirname(here)))
         exename = "_testembed"
         if sys.platform.startswith("win"):
             ext = ("_d" if "_d" in sys.executable else "") + ".exe"