Skip to content

Commit 32837a6

Browse files
committed
[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.
1 parent 06d3fce commit 32837a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/utils/lit/tests/lit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ if llvm_config:
4040
llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
4141
else:
4242
config.environment['PYTHONPATH'] = os.pathsep.join([lit_path])
43+
# Do not add user-site packages directory to the python search path. This avoids test failures if there's an
44+
# incompatible lit module installed inside the user-site packages directory, as it gets prioritized over the lit
45+
# from the PYTHONPATH.
46+
config.environment['PYTHONNOUSERSITE'] = '1'
4347

4448
# Add llvm and lit tools directories if this config is being loaded indirectly.
4549
# In this case, we can also expect llvm_config to have been imported correctly.

0 commit comments

Comments
 (0)