Skip to content
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

TST: add basic clipboard test #4282

Merged
merged 1 commit into from
Jul 25, 2013
Merged

TST: add basic clipboard test #4282

merged 1 commit into from
Jul 25, 2013

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Jul 18, 2013

No description provided.

@ghost ghost assigned cpcloud Jul 18, 2013
@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

bet xclip/xsel not installed?

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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

@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

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

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

Sorry I mean I will. Android completion..

@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

OT

@cpcloud

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

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

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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

@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

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

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

He could submit a pr to your branch

@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

have you tried that? does it work?

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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
Copy link
Contributor

jreback commented Jul 18, 2013

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
Copy link
Member Author

cpcloud commented Jul 18, 2013

excellent!

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

@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
Copy link
Contributor

jreback commented Jul 18, 2013

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

@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

amazing complicated to test this!

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

xclip is working yay

@jreback
Copy link
Contributor

jreback commented Jul 18, 2013

awesome!

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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

@cpcloud
Copy link
Member Author

cpcloud commented Jul 18, 2013

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

  • xclip
  • qt4
  • xsel
  • gtk
  • 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...

@cpcloud
Copy link
Member Author

cpcloud commented Jul 19, 2013

@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
Copy link
Contributor

jreback commented Jul 19, 2013

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
Copy link
Contributor

jreback commented Jul 19, 2013

so not a bug

@cpcloud
Copy link
Member Author

cpcloud commented Jul 24, 2013

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

@jreback
Copy link
Contributor

jreback commented Jul 24, 2013

merge away
even bigger ok

@cpcloud
Copy link
Member Author

cpcloud commented Jul 25, 2013

@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
Copy link

ghost commented Jul 25, 2013

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
Copy link
Member Author

cpcloud commented Jul 25, 2013

@y-p ok, thanks for the input.

@ghost
Copy link

ghost commented Jul 25, 2013

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
Copy link
Member Author

cpcloud commented Jul 25, 2013

i have pyside installed i'll check it out

@cpcloud
Copy link
Member Author

cpcloud commented Jul 25, 2013

works with pyside==1.2.0

Also add support for PySide
cpcloud added a commit that referenced this pull request Jul 25, 2013
@cpcloud cpcloud merged commit 6c8fca9 into pandas-dev:master Jul 25, 2013
@cpcloud cpcloud deleted the add-clipboard-test branch July 25, 2013 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants