aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/libregrtest/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/libregrtest/utils.py')
-rw-r--r--Lib/test/libregrtest/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index d47e9388e62..d4972ce4a50 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -377,10 +377,19 @@ def get_temp_dir(tmp_dir: StrPath | None = None) -> StrPath:
# Python out of the source tree, especially when the
# source tree is read only.
tmp_dir = sysconfig.get_config_var('srcdir')
+ if not tmp_dir:
+ raise RuntimeError(
+ "Could not determine the correct value for tmp_dir"
+ )
tmp_dir = os.path.join(tmp_dir, 'build')
else:
# WASI platform
tmp_dir = sysconfig.get_config_var('projectbase')
+ if not tmp_dir:
+ raise RuntimeError(
+ "sysconfig.get_config_var('projectbase') "
+ f"unexpectedly returned {tmp_dir!r} on WASI"
+ )
tmp_dir = os.path.join(tmp_dir, 'build')
# When get_temp_dir() is called in a worker process,