Skip to content

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


# 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

3 participants