From 6e8e0d125df976eaab10d7b7e5f56cb2bd62b9b8 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Mon, 18 Nov 2019 12:57:50 -0600 Subject: [PATCH 1/5] restore clipboard setup? --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 048736e4bf1d0..398dd07089ef9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,6 +85,15 @@ install: - ci/submit_cython_cache.sh - echo "install done" + +before_script: + # display server (for clipboard functionality) needs to be started here, + # does not work if done in install:setup_env.sh (GH-26103) + - export DISPLAY=":99.0" + - echo "sh -e /etc/init.d/xvfb start" + - if [ "$JOB" != "3.8-dev" ]; then sh -e /etc/init.d/xvfb start; fi + - sleep 3 + script: - echo "script start" - echo "$JOB" From a93b9d8074a768f79b6da45eb4859a4efac421ed Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Mon, 18 Nov 2019 13:41:44 -0600 Subject: [PATCH 2/5] try fix --- .travis.yml | 9 --------- ci/run_tests.sh | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 398dd07089ef9..048736e4bf1d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,15 +85,6 @@ install: - ci/submit_cython_cache.sh - echo "install done" - -before_script: - # display server (for clipboard functionality) needs to be started here, - # does not work if done in install:setup_env.sh (GH-26103) - - export DISPLAY=":99.0" - - echo "sh -e /etc/init.d/xvfb start" - - if [ "$JOB" != "3.8-dev" ]; then sh -e /etc/init.d/xvfb start; fi - - sleep 3 - script: - echo "script start" - echo "$JOB" diff --git a/ci/run_tests.sh b/ci/run_tests.sh index b91cfb3bed8cc..d13fc381e8a43 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -29,7 +29,7 @@ PYTEST_CMD="pytest -m \"$PATTERN\" -n auto --dist=loadfile -s --strict --duratio # Travis does not have have an X server if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - DISPLAY=DISPLAY=:99.0 + export DISPLAY=:99.0 PYTEST_CMD="xvfb-run -e /dev/stdout $PYTEST_CMD" fi From 479208e8554bb69aa146684ad3b6e92c787d3833 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Tue, 19 Nov 2019 09:43:26 -0600 Subject: [PATCH 3/5] silence lzma warnings --- pandas/tests/io/test_compression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/test_compression.py b/pandas/tests/io/test_compression.py index d68b6a1effaa0..9bcdda2039458 100644 --- a/pandas/tests/io/test_compression.py +++ b/pandas/tests/io/test_compression.py @@ -140,7 +140,7 @@ def test_with_missing_lzma(): import pandas """ ) - subprocess.check_output([sys.executable, "-c", code]) + subprocess.check_output([sys.executable, "-c", code], stderr=subprocess.PIPE) def test_with_missing_lzma_runtime(): @@ -157,4 +157,4 @@ def test_with_missing_lzma_runtime(): df.to_csv('foo.csv', compression='xz') """ ) - subprocess.check_output([sys.executable, "-c", code]) + subprocess.check_output([sys.executable, "-c", code], stderr=subprocess.PIPE) From ed9ae5f56492bdfb6c214e4ea135a037c63f3b0c Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Tue, 19 Nov 2019 10:01:40 -0600 Subject: [PATCH 4/5] debug output --- pandas/io/clipboard/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/io/clipboard/__init__.py b/pandas/io/clipboard/__init__.py index 4f690a57893d1..014e49c8cecf5 100644 --- a/pandas/io/clipboard/__init__.py +++ b/pandas/io/clipboard/__init__.py @@ -627,6 +627,8 @@ def lazy_load_stub_copy(text): """ global copy, paste copy, paste = determine_clipboard() + print("*" * 40, " CLIPBOARDS ", "*" * 40) + print(copy.__name__, paste.__name__) return copy(text) @@ -649,6 +651,8 @@ def lazy_load_stub_paste(): """ global copy, paste copy, paste = determine_clipboard() + print("*" * 40, " CLIPBOARDS ", "*" * 40) + print(copy.__name__, paste.__name__) return paste() From 6557e9b10f4e4138f674bff1788a56d109c66617 Mon Sep 17 00:00:00 2001 From: Tom Augspurger Date: Tue, 19 Nov 2019 10:13:07 -0600 Subject: [PATCH 5/5] lazy check --- pandas/tests/io/test_clipboard.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index 4559ba264d8b7..2801a83384278 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -10,12 +10,6 @@ from pandas.io.clipboard import PyperclipException, clipboard_get, clipboard_set -try: - DataFrame({"A": [1, 2]}).to_clipboard() - _DEPS_INSTALLED = 1 -except (PyperclipException, RuntimeError): - _DEPS_INSTALLED = 0 - def build_kwargs(sep, excel): kwargs = {} @@ -146,9 +140,17 @@ def test_mock_clipboard(mock_clipboard): assert result == "abc" +@pytest.fixture(scope="module") +def check_clipboard(): + """Check if we have a clipboard, skipping if it's not present""" + try: + DataFrame({"A": [1, 2]}).to_clipboard() + except (PyperclipException, RuntimeError): + pytest.skip("Missing clipboard dependency") + + @pytest.mark.single @pytest.mark.clipboard -@pytest.mark.skipif(not _DEPS_INSTALLED, reason="clipboard primitives not installed") @pytest.mark.usefixtures("mock_clipboard") class TestClipboard: def check_round_trip_frame(self, data, excel=None, sep=None, encoding=None): @@ -256,8 +258,8 @@ def test_round_trip_valid_encodings(self, enc, df): @pytest.mark.single @pytest.mark.clipboard -@pytest.mark.skipif(not _DEPS_INSTALLED, reason="clipboard primitives not installed") @pytest.mark.parametrize("data", ["\U0001f44d...", "Ωœ∑´...", "abcd..."]) +@pytest.mark.usefixtures("check_clipboard") def test_raw_roundtrip(data): # PR #25040 wide unicode wasn't copied correctly on PY3 on windows clipboard_set(data)