From a7ea1117464cafa0a49c06133e5fb08311798359 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 21 Jun 2019 08:30:01 -0500 Subject: [PATCH 1/6] debug --- .travis.yml | 1 + foo.patch | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 foo.patch diff --git a/.travis.yml b/.travis.yml index 329693d..bedaf79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,7 @@ before_install: install: # Maybe get and clean and patch source - clean_code $REPO_DIR $BUILD_COMMIT + - git -C pandas apply ../foo.patch - build_wheel $REPO_DIR $PLAT script: diff --git a/foo.patch b/foo.patch new file mode 100644 index 0000000..c17f26a --- /dev/null +++ b/foo.patch @@ -0,0 +1,16 @@ +diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py +index 9fe8b0f95..470108ae4 100644 +--- a/pandas/tests/test_downstream.py ++++ b/pandas/tests/test_downstream.py +@@ -135,8 +135,9 @@ def test_pyarrow(df): + + def test_missing_required_dependency(): + # GH 23868 +- # use the -S flag to disable site-packages +- call = ['python', '-S', '-c', 'import pandas'] ++ # -s : disable user site-packages ++ # -S : disable module site ++ call = ['python', '-s' '-S', '-c', 'import pandas'] + + with pytest.raises(subprocess.CalledProcessError) as exc: + subprocess.check_output(call, stderr=subprocess.STDOUT) From d14c63d793aaff584d7473c28dcbc27c81f8039a Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 21 Jun 2019 09:02:31 -0500 Subject: [PATCH 2/6] debug --- foo.patch | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/foo.patch b/foo.patch index c17f26a..7c2df31 100644 --- a/foo.patch +++ b/foo.patch @@ -1,16 +1,15 @@ diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py -index 9fe8b0f95..470108ae4 100644 +index 9fe8b0f95..9df1ee690 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py -@@ -135,8 +135,9 @@ def test_pyarrow(df): - +@@ -136,7 +136,9 @@ def test_pyarrow(df): def test_missing_required_dependency(): # GH 23868 -- # use the -S flag to disable site-packages + # use the -S flag to disable site-packages - call = ['python', '-S', '-c', 'import pandas'] -+ # -s : disable user site-packages -+ # -S : disable module site -+ call = ['python', '-s' '-S', '-c', 'import pandas'] ++ # This test fails if any of numpy, pytz, and dateutil are installed ++ # in the ++ call = ['python', '-S', '-s', '-E', '-c', 'import pandas'] with pytest.raises(subprocess.CalledProcessError) as exc: subprocess.check_output(call, stderr=subprocess.STDOUT) From 9487858ac5fa29281af320d4ea10943541d19f32 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 21 Jun 2019 09:38:22 -0500 Subject: [PATCH 3/6] debug --- foo.patch | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/foo.patch b/foo.patch index 7c2df31..590903e 100644 --- a/foo.patch +++ b/foo.patch @@ -1,15 +1,22 @@ diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py -index 9fe8b0f95..9df1ee690 100644 +index 9fe8b0f95..f1ee5723d 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py -@@ -136,7 +136,9 @@ def test_pyarrow(df): +@@ -135,11 +135,15 @@ def test_pyarrow(df): + def test_missing_required_dependency(): # GH 23868 - # use the -S flag to disable site-packages +- # use the -S flag to disable site-packages - call = ['python', '-S', '-c', 'import pandas'] -+ # This test fails if any of numpy, pytz, and dateutil are installed -+ # in the ++ # To ensure proper isolation, we pass these flags ++ # -S : disable site-packages ++ # -s : disable user site-packages ++ # -E : disable PYTHON* env vars, especially PYTHONPATH + call = ['python', '-S', '-s', '-E', '-c', 'import pandas'] with pytest.raises(subprocess.CalledProcessError) as exc: subprocess.check_output(call, stderr=subprocess.STDOUT) + + output = exc.value.stdout.decode() ++ assert output == b'123' + assert all(x in output for x in ['numpy', 'pytz', 'dateutil']) From 3d2ffe980f1bb9e2178477ac1985ce35848363c3 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 21 Jun 2019 13:58:00 -0500 Subject: [PATCH 4/6] debug --- foo.patch | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/foo.patch b/foo.patch index 590903e..8f88a8a 100644 --- a/foo.patch +++ b/foo.patch @@ -1,22 +1,25 @@ diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py -index 9fe8b0f95..f1ee5723d 100644 +index e76315299..9be107f9c 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py -@@ -135,11 +135,15 @@ def test_pyarrow(df): - - def test_missing_required_dependency(): - # GH 23868 -- # use the -S flag to disable site-packages -- call = ['python', '-S', '-c', 'import pandas'] -+ # To ensure proper isolation, we pass these flags -+ # -S : disable site-packages -+ # -s : disable user site-packages -+ # -E : disable PYTHON* env vars, especially PYTHONPATH -+ call = ['python', '-S', '-s', '-E', '-c', 'import pandas'] +@@ -139,7 +139,19 @@ def test_missing_required_dependency(): + # -S : disable site-packages + # -s : disable user site-packages + # -E : disable PYTHON* env vars, especially PYTHONPATH +- call = ['python', '-S', '-s', '-E', '-c', 'import pandas'] ++ # And, that's apparently not enough, so we give up. ++ # https://github.com/MacPython/pandas-wheels/pull/50 ++ try: ++ subprocess.check_output(['python', '-sSE', '-c', 'import numpy'], ++ stderr=subprocess.DEVNULL) ++ except subprocess.CalledProcessError: ++ # NumPy is not around, we can do the test ++ pass ++ else: ++ # NumPy is in the isolation environment, give up. ++ pytest.skip("Required dependencies in isolated environment.") ++ ++ call = ['python', '-sSE', '-c', 'import pandas'] with pytest.raises(subprocess.CalledProcessError) as exc: subprocess.check_output(call, stderr=subprocess.STDOUT) - - output = exc.value.stdout.decode() -+ assert output == b'123' - assert all(x in output for x in ['numpy', 'pytz', 'dateutil']) From fde33a7bedf17f7ce24d22c098984446b979a723 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 21 Jun 2019 13:59:20 -0500 Subject: [PATCH 5/6] debug --- foo.patch | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/foo.patch b/foo.patch index 8f88a8a..c72ba12 100644 --- a/foo.patch +++ b/foo.patch @@ -1,12 +1,17 @@ diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py -index e76315299..9be107f9c 100644 +index 9fe8b0f95..9be107f9c 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py -@@ -139,7 +139,19 @@ def test_missing_required_dependency(): - # -S : disable site-packages - # -s : disable user site-packages - # -E : disable PYTHON* env vars, especially PYTHONPATH -- call = ['python', '-S', '-s', '-E', '-c', 'import pandas'] +@@ -135,8 +135,23 @@ def test_pyarrow(df): + + def test_missing_required_dependency(): + # GH 23868 +- # use the -S flag to disable site-packages +- call = ['python', '-S', '-c', 'import pandas'] ++ # To ensure proper isolation, we pass these flags ++ # -S : disable site-packages ++ # -s : disable user site-packages ++ # -E : disable PYTHON* env vars, especially PYTHONPATH + # And, that's apparently not enough, so we give up. + # https://github.com/MacPython/pandas-wheels/pull/50 + try: From b90040f5648a58e7d3547de739503fec21c13263 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Fri, 21 Jun 2019 14:57:08 -0500 Subject: [PATCH 6/6] debug --- foo.patch | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/foo.patch b/foo.patch index c72ba12..04a23de 100644 --- a/foo.patch +++ b/foo.patch @@ -1,8 +1,8 @@ diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py -index 9fe8b0f95..9be107f9c 100644 +index 9fe8b0f95..4660da269 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py -@@ -135,8 +135,23 @@ def test_pyarrow(df): +@@ -135,11 +135,27 @@ def test_pyarrow(df): def test_missing_required_dependency(): # GH 23868 @@ -28,3 +28,8 @@ index 9fe8b0f95..9be107f9c 100644 with pytest.raises(subprocess.CalledProcessError) as exc: subprocess.check_output(call, stderr=subprocess.STDOUT) + + output = exc.value.stdout.decode() +- assert all(x in output for x in ['numpy', 'pytz', 'dateutil']) ++ for name in ['numpy', 'pytz', 'dateutil']: ++ assert name in output