@@ -135,8 +135,23 @@ def test_pyarrow(df):
135
135
136
136
def test_missing_required_dependency ():
137
137
# GH 23868
138
- # use the -S flag to disable site-packages
139
- call = ['python' , '-S' , '-c' , 'import pandas' ]
138
+ # To ensure proper isolation, we pass these flags
139
+ # -S : disable site-packages
140
+ # -s : disable user site-packages
141
+ # -E : disable PYTHON* env vars, especially PYTHONPATH
142
+ # And, that's apparently not enough, so we give up.
143
+ # https://github.com/MacPython/pandas-wheels/pull/50
144
+ try :
145
+ subprocess .check_output (['python' , '-sSE' , '-c' , 'import numpy' ],
146
+ stderr = subprocess .DEVNULL )
147
+ except subprocess .CalledProcessError :
148
+ # NumPy is not around, we can do the test
149
+ pass
150
+ else :
151
+ # NumPy is in the isolation environment, give up.
152
+ pytest .skip ("Required dependencies in isolated environment." )
153
+
154
+ call = ['python' , '-sSE' , '-c' , 'import pandas' ]
140
155
141
156
with pytest .raises (subprocess .CalledProcessError ) as exc :
142
157
subprocess .check_output (call , stderr = subprocess .STDOUT )
0 commit comments