Skip to content

TST: Mock clipboard IO #22715

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

Merged
merged 6 commits into from
Sep 16, 2018
Merged

TST: Mock clipboard IO #22715

merged 6 commits into from
Sep 16, 2018

Conversation

TomAugspurger
Copy link
Contributor

No idea if this will work on not.

@TomAugspurger TomAugspurger added CI Continuous Integration Unreliable Test Unit tests that occasionally fail labels Sep 14, 2018
@TomAugspurger TomAugspurger changed the title Clipboard Box clipboard tests on travis Sep 14, 2018
@TomAugspurger
Copy link
Contributor Author

This failed.

Unless anyone objects, I'm going to just mock the actual clipboard layer part of things.

@jreback
Copy link
Contributor

jreback commented Sep 15, 2018

yeah the clipboard tests are annoying

@pep8speaks
Copy link

pep8speaks commented Sep 15, 2018

Hello @TomAugspurger! Thanks for updating the PR.

Comment last updated on September 16, 2018 at 11:57 Hours UTC

@TomAugspurger
Copy link
Contributor Author

OK, I think we're still testing things, but would appreciate a close look at the mocks.

Basic idea is to replace get_clipboard / set_clipboard with a simple dict mapping test_id -> data.

Unfortunately, we had some tests in test_clipboard that directly used clipboard_get and clipboard_set, so I had to directly manipulate the dict for those tests...

@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Sep 15, 2018
@@ -76,10 +76,41 @@ def df(request):
raise ValueError


# our local clipboard for tests
_mock_data = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it’s really odd to keep state outside of this fixture when it’s a function level

why don’t u just make it a module level?
or it seems that function level might be ok with state inside

@pytest.fixture
def mock_clipboard(mock, request):
def _mock_set(data):
_mock_data[request.node.name] = data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u add a docstring

class TestClipboard(object):

@pytest.mark.clipboard
def test_mock_clipboard(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can’t u use monkey patch here?

@TomAugspurger TomAugspurger changed the title Box clipboard tests on travis TST: Mock clipboard IO Sep 16, 2018
@TomAugspurger
Copy link
Contributor Author

Moved the mock clipboard to be function-scope, rather than global.

@TomAugspurger
Copy link
Contributor Author

@jreback any objections to merging? I wouldn't usually move this quickly but

a.) these tests have been failing forever
b.) It's kinda blocking #22699

@jreback
Copy link
Contributor

jreback commented Sep 16, 2018

sure

@jreback jreback merged commit 8a1c8ad into pandas-dev:master Sep 16, 2018
aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request Sep 20, 2018
* Attempt to fix clipboard tests

* note

* update

* update

* doc
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
* Attempt to fix clipboard tests

* note

* update

* update

* doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Unreliable Test Unit tests that occasionally fail
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants