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

Fix xclip on Travis. #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix xclip on Travis. #22

wants to merge 3 commits into from

Conversation

prabi
Copy link
Contributor

@prabi prabi commented May 13, 2019

I started Xvfb and set up the DISPLAY environment variable on Travis, so xclip tests can be run.

Also sorry for chiming in on an earlier pull request by referencing it, it was unintentional.

@aviau
Copy link
Owner

aviau commented May 13, 2019

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.

@coveralls
Copy link

coveralls commented May 13, 2019

Coverage Status

Coverage increased (+3.7%) to 95.149% when pulling e76ec57 on prabi:fix_test_envs into 1845229 on aviau:master.

@prabi
Copy link
Contributor Author

prabi commented May 13, 2019

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

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)
Copy link
Owner

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?

Copy link
Contributor Author

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.

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.

3 participants