-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix xclip on Travis. #22
base: master
Are you sure you want to change the base?
Conversation
nicee! Would it work if we put export DISPLAY=:99.0 in before_script? So that we wouldn't have to copy it to every env. |
Seems like it would. :-) |
.travis.yml
Outdated
@@ -29,8 +29,12 @@ install: | |||
- git config --global user.email "you@example.com" | |||
- git config --global user.name "Your Name" | |||
- sudo apt-get install -y tree | |||
- sudo apt-get install -y xclip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you merge this with the other apt-get install so that it is faster?
apt-get install -y tree xclip
def test_generate_clip(self): | ||
generate = self.run_cli(['generate', '-c', 'clip.me']) | ||
|
||
self.assertEqual(generate.output, 'Copied clip.me to clipboard.\n') | ||
|
||
time.sleep(0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aww this is required?
timing dependent tests always bite you back.
Is this because pypass exits before waiting for xclip to exit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I'm not well versed in the inner workings of xclip
, but if my intuition is correct, invoking xclip
is async: it terminates the invoked process before its background process clears and writes on (also propably not atomically) the clipboard. Therefore, this test could (and sometimes did before I added time.sleep
) read the clipboard before the desired content is there. Since there isn't a Future
I could wait on, I chose this method instead.
What I really don't understand is why this test is problematic, but test_show_clip()
seems to work like a charm, and they are coded the same way...
I appreciate every pointer in the right direction.
I started
Xvfb
and set up theDISPLAY
environment variable on Travis, soxclip
tests can be run.Also sorry for chiming in on an earlier pull request by referencing it, it was unintentional.