From 24a95d3e69ed7e3b47ec6781229cead0f63e5ba6 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Mon, 26 Oct 2020 17:40:01 +0000 Subject: [PATCH 1/3] apply patch --- pandas/tests/test_downstream.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index c03e8e26952e5..7da9223a67bf8 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -150,6 +150,12 @@ def test_missing_required_dependency(): # https://github.com/MacPython/pandas-wheels/pull/50 pyexe = sys.executable.replace("\\", "/") + + call = [pyexe, "-c", "import pandas;pandas.__file__"] + output = subprocess.check_output(call).decode() + if "site-packages" in output: + pytest.skip("pandas installed as site package") + call = [pyexe, "-sSE", "-c", "import pandas"] msg = ( From b6f781088cddf0fc48844ca3a6c4241fb186164f Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Mon, 26 Oct 2020 19:22:06 +0000 Subject: [PATCH 2/3] doh needs print statement --- pandas/tests/test_downstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index 7da9223a67bf8..aadd7ac2e1e60 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -151,7 +151,7 @@ def test_missing_required_dependency(): pyexe = sys.executable.replace("\\", "/") - call = [pyexe, "-c", "import pandas;pandas.__file__"] + call = [pyexe, "-c", "import pandas;print(pandas.__file__)"] output = subprocess.check_output(call).decode() if "site-packages" in output: pytest.skip("pandas installed as site package") From d032da252bba63824dde79fa2fe20efa378180ce Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 27 Oct 2020 08:41:19 +0000 Subject: [PATCH 3/3] add comments --- pandas/tests/test_downstream.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index aadd7ac2e1e60..392be699b6fc0 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -151,11 +151,17 @@ def test_missing_required_dependency(): pyexe = sys.executable.replace("\\", "/") + # We skip this test if pandas is installed as a site package. We first + # import the package normally and check the path to the module before + # executing the test which imports pandas with site packages disabled. call = [pyexe, "-c", "import pandas;print(pandas.__file__)"] output = subprocess.check_output(call).decode() if "site-packages" in output: pytest.skip("pandas installed as site package") + # This test will fail if pandas is installed as a site package. The flags + # prevent pandas being imported and the test will report Failed: DID NOT + # RAISE call = [pyexe, "-sSE", "-c", "import pandas"] msg = (