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

Properly test clipr_available() #21

Closed
mdlincoln opened this issue Nov 25, 2016 · 2 comments
Closed

Properly test clipr_available() #21

mdlincoln opened this issue Nov 25, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@mdlincoln
Copy link
Owner

After putting much effort into getting clipr to test properly on Travis (#14), there's still the issue of correctly testing whether clipr_available() actually does the job properly. Since we're using a build matrix on Travis, it's possible to explicitly test this function when we know that clipr ought to work (when DISPLAY=:90.0) and when it ought to fail (DISPLAY="").

This is the code I'm currently trying:

test_that("clipr_available fails when DISPLAY is not configured; 
succeeds when it is", {
  # Only run this test on Travis
  skip_if_not(identical(Sys.getenv("TRAVIS"), "true"))
  if (identical(Sys.getenv("DISPLAY"), ""))
    expect_false(clipr_available())
  if (identical(Sys.getenv("DISPLAY"), ":90.0"))
    expect_true(clipr_available())
})

Unfortunately, this test appears to fail when it ought to pass, clipr_available() returning FALSE when the Travis environment ought to be properly configured. Oddly, it fails even when incorporating the fix from #20

@mdlincoln mdlincoln added this to the 0.3.0 milestone Nov 25, 2016
@mdlincoln mdlincoln self-assigned this Nov 25, 2016
@mdlincoln mdlincoln added the bug label Nov 25, 2016
@krivit
Copy link
Contributor

krivit commented Nov 26, 2016

For what it's worth, I just tested the version from #20, and it returns the correct answer within X (TRUE) and on a bare shell (FALSE).

I don't know TravisCI well enough to speculate what's going on. Can the R process see the DISPLAY variables? Is R under Travis built with X capabilities? What does capabilities("X11") say?

@mdlincoln
Copy link
Owner Author

Turns out I had the DISPLAY variable set incorrectly - it should have been :99.0 instead of :90.0 🤕 The fix passes on Travis now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants