TST: add basic clipboard test
State: closed


Labels:

Comments:
bet `xclip/xsel` not installed?

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

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

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

Sorry I mean I will. Android completion.. 

OT

@cpcloud 

how does Komman.... push a fix to my open PR: https://github.com/pydata/pandas/pull/3482 ?

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

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

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

He could submit a pr to your branch 

have you tried that? does it work?

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

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...:)

excellent!

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

``` python
        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.')
```

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

amazing complicated to test this!

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

there's hope yet! http://about.travis-ci.org/docs/user/gui-and-headless-browsers/

xclip is  working yay

awesome!

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

darn fail on python3.3 :expressionless: 

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
- [x] `xclip`
- [x] `qt4`
- [x] `xsel`
- [x] `gtk`
- [x] properly skipped if no clipboard installed (see python 2.6 build)

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

@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
```

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

so not a bug 

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

merge away
even bigger ok

@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.

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. 

@y-p ok, thanks for the input.