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 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() 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) 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)