[llvm] 32837a6 - [lit] Drop the user-site packages directory from search paths when running tests

Alex Lorenz via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 27 13:31:20 PDT 2019


Author: Alex Lorenz
Date: 2019-10-27T13:31:02-07:00
New Revision: 32837a60ac4ff43182699073729daed2cd0ed421

URL: https://github.com/llvm/llvm-project/commit/32837a60ac4ff43182699073729daed2cd0ed421
DIFF: https://github.com/llvm/llvm-project/commit/32837a60ac4ff43182699073729daed2cd0ed421.diff

LOG: [lit] Drop the user-site packages directory from search paths when running tests

Do not add user-site packages directory to the python search path.
This avoids test failures if there's an incompatible lit module installed
inside the user-site packages directory, as it gets prioritized over the lit
from the PYTHONPATH.

Added: 
    

Modified: 
    llvm/utils/lit/tests/lit.cfg

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index 26b3a1147d29..6205615f0139 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -40,6 +40,10 @@ if llvm_config:
   llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
 else:
   config.environment['PYTHONPATH'] = os.pathsep.join([lit_path])
+# Do not add user-site packages directory to the python search path. This avoids test failures if there's an
+# incompatible lit module installed inside the user-site packages directory, as it gets prioritized over the lit
+# from the PYTHONPATH.
+config.environment['PYTHONNOUSERSITE'] = '1'
 
 # Add llvm and lit tools directories if this config is being loaded indirectly.
 # In this case, we can also expect llvm_config to have been imported correctly.


        


More information about the llvm-commits mailing list