TST: add basic clipboard test by cpcloud · Pull Request #4282 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation33 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

cpcloud

@jreback

bet xclip/xsel not installed?

@cpcloud

Yep. It's raising exception now. I'm going to convert to oserror.

@jreback

can you just install those? I think the exception is correct (its telling you that you don't have the deps installed)

@cpcloud

I yep u will. Sorry I meant for just one build to make sure they skip properly

@cpcloud

Sorry I mean I will. Android completion..

@jreback

OT

@cpcloud

how does Komman.... push a fix to my open PR: #3482 ?

git push https://github.com/jreback/pandas.git/series2 ???

@cpcloud

Don't think he can unless he is a collab on ur repo.

@jreback

ahhh...so best that I pull down his branch and cherry-pick to mine?

@cpcloud

He could submit a pr to your branch

@jreback

have you tried that? does it work?

@cpcloud

Haven't tried the pr thing... But the cherry pick should work. I'm on my phone so I can't try just yet

@jreback

he did a PR and I was able to merge that commit in...nice and clean!

I guess that's how its suppposed to work...:)

@cpcloud

@cpcloud

@jreback xsel will never get used if it exists and one of those GUI frameworks is there...is that on purpose?

    if xselExists:
        getcb = xselGetClipboard
        setcb = xselSetClipboard
    try:
        import gtk
        getcb = gtkGetClipboard
        setcb = gtkSetClipboard
    except:
        try:
            import PyQt4.QtCore
            import PyQt4.QtGui
            app = PyQt4.QtGui.QApplication([])
            cb = PyQt4.QtGui.QApplication.clipboard()
            getcb = qtGetClipboard
            setcb = qtSetClipboard
        except:
            raise NoClipboardProgramError('Pyperclip requires the gtk or'
                                          ' PyQt4 module installed, or '
                                          'the xclip command.')

@jreback

it was copied from pyperclip directly
I think xsel is a fallback in some plstforms Mac?

@jreback

amazing complicated to test this!

@cpcloud

no kidding, i feel like i'm shooting in the dark too. i don't like fixing things "randomly" either.

@cpcloud

@cpcloud

@jreback

@cpcloud

looks like xsel is working too, i'm anxiously watching travis builds 😨

@cpcloud

darn fail on python3.3 😑

but that's because i'm using too high of precision for floating-point comparisons

xclip and qt4 clipboards are tested.
i think the code should have an else to use xsel if present otherwise use one of the gui frameworks

should also test the gtk clipboard just to be complete

so

of course we have no mac or windows testing...so i guess rely on users to tell us if something broken...

@cpcloud

@jreback is this a bug?

In [1]: paste
DataFrame({'a': np.arange(1.0, 6.0),
                                       'b': np.arange(1, 6),
                                       'c': list('abcde')})

## -- End pasted text --
Out[1]:
   a  b  c
0  1  1  a
1  2  2  b
2  3  3  c
3  4  4  d
4  5  5  e

In [2]: _1
Out[2]:
   a  b  c
0  1  1  a
1  2  2  b
2  3  3  c
3  4  4  d
4  5  5  e

In [3]: df = _1

In [4]: df
Out[4]:
   a  b  c
0  1  1  a
1  2  2  b
2  3  3  c
3  4  4  d
4  5  5  e

In [5]: df.dtypes
Out[5]:
a    float64
b      int64
c     object
dtype: object

In [6]: df.to_clipboard()
/usr/bin/xclip

In [7]: read_clipboard().dtypes
Out[7]:
a     int64
b     int64
c    object
dtype: object

@jreback

I think this read as text like a csv file
u would need to specify a dtype mapping (it uses read_table for parsing)

@jreback

@cpcloud

@jreback what's the story with merging? can small bug fixes and such be merged?

@jreback

merge away
even bigger ok

@cpcloud

@y-p I would like your seal of approval here before merging, if you get a chance. Thanks, much appreciated.

One thing to note is that to add env vars to the 2.6 row of the build matrix i have to add it explicitly using include: and then use exclude: to exclude the python version added by travis. You can't remove python: to acheive the same effect otherwise it will, by default, add another python 2.7 version. It's possible that there's a more elegant way to do this, but it wasn't clear to me from reading the travis docs what that is.

@ghost

I floated the python: vs build-matrix issue on the travis-ci issue tracker a few months ago,
they acknowledged it but I'd consider it a wontfix until further notice.

I don't see any problems in the diff, if travis is green - go for it.

@cpcloud

@y-p ok, thanks for the input.

@ghost

one thing, I'm not sure what pyperclip accepts, but there's a good chance that pyside should
be interchangable with pyqt if it's available. So the checks for pyqt may be too strict.

@cpcloud

i have pyside installed i'll check it out

@cpcloud

@cpcloud

Also add support for PySide

cpcloud added a commit that referenced this pull request

Jul 25, 2013

@cpcloud

TST: add basic clipboard test

@cpcloud cpcloud deleted the add-clipboard-test branch

July 25, 2013 22:06

2 participants

@cpcloud @jreback