Skip to content

restore clipboard setup? #29695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions pandas/io/clipboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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()


Expand Down
18 changes: 10 additions & 8 deletions pandas/tests/io/test_clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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)