diff options
author | Éric Araujo <merwok@netwok.org> | 2011-10-07 23:55:07 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-10-07 23:55:07 (GMT) |
commit | de504550afc211dbc7c203fac0646f5e1329a158 (patch) | |
tree | 1e2bebceb80786da0f98a95c19cbf8cd8304ae68 | |
parent | 47a4521ecec0cdf9976717bd565c37bee3f566ab (diff) | |
download | cpython-de504550afc211dbc7c203fac0646f5e1329a158.zip cpython-de504550afc211dbc7c203fac0646f5e1329a158.tar.gz cpython-de504550afc211dbc7c203fac0646f5e1329a158.tar.bz2 |
Fix test_sysconfig when prefix != exec-prefix (#9100).
I tested this manually; it would be great to have buildbots using
installed Pythons, including Pythons configured with different prefix
and exec-prefix.
Reported by Zsolt Cserna.
-rw-r--r-- | Lib/test/test_sysconfig.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index b2a3224..aabb6fa 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -1,9 +1,5 @@ -"""Tests for 'site'. +"""Tests for sysconfig.""" -Tests assume the initial paths in sys.path once the interpreter has begun -executing have not been removed. - -""" import unittest import sys import os @@ -11,7 +7,7 @@ import subprocess import shutil from copy import copy, deepcopy -from test.support import (run_unittest, TESTFN, unlink, get_attribute, +from test.support import (run_unittest, TESTFN, unlink, captured_stdout, skip_unless_symlink) import sysconfig @@ -265,8 +261,15 @@ class TestSysConfig(unittest.TestCase): # is similar to the global posix_prefix one base = get_config_var('base') user = get_config_var('userbase') + # the global scheme mirrors the distinction between prefix and + # exec-prefix but not the user scheme, so we have to adapt the paths + # before comparing (issue #9100) + adapt = sys.prefix != sys.exec_prefix for name in ('stdlib', 'platstdlib', 'purelib', 'platlib'): global_path = get_path(name, 'posix_prefix') + if adapt: + global_path = global_path.replace(sys.exec_prefix, sys.prefix) + base = base.replace(sys.exec_prefix, sys.prefix) user_path = get_path(name, 'posix_user') self.assertEqual(user_path, global_path.replace(base, user, 1)) |