Skip to content

Commit f87111f

Browse files
Backport PR #37428: Failing test_missing_required_dependency in pandas-wheels (#37445)
Co-authored-by: Simon Hawkins <[email protected]>
1 parent 5498df4 commit f87111f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/test_downstream.py

+12
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ def test_missing_required_dependency():
150150
# https://github.com/MacPython/pandas-wheels/pull/50
151151

152152
pyexe = sys.executable.replace("\\", "/")
153+
154+
# We skip this test if pandas is installed as a site package. We first
155+
# import the package normally and check the path to the module before
156+
# executing the test which imports pandas with site packages disabled.
157+
call = [pyexe, "-c", "import pandas;print(pandas.__file__)"]
158+
output = subprocess.check_output(call).decode()
159+
if "site-packages" in output:
160+
pytest.skip("pandas installed as site package")
161+
162+
# This test will fail if pandas is installed as a site package. The flags
163+
# prevent pandas being imported and the test will report Failed: DID NOT
164+
# RAISE <class 'subprocess.CalledProcessError'>
153165
call = [pyexe, "-sSE", "-c", "import pandas"]
154166

155167
msg = (

0 commit comments

Comments
 (0)