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

webmockr in tests without installing all adapters #45

Closed
maelle opened this issue Oct 30, 2018 · 11 comments
Closed

webmockr in tests without installing all adapters #45

maelle opened this issue Oct 30, 2018 · 11 comments
Labels
Milestone

Comments

@maelle
Copy link
Member

maelle commented Oct 30, 2018

👋 @sckott!

We're seeing a test failure over at HIBPwned, one of which is due to webmockr https://travis-ci.org/lockedata/HIBPwned/jobs/447952505#L1729 I'd like to enable webmockr for crul only. Would it be possible to pass an option? Or maybe could webmockr find which adapter to use automatically by e.g. looking at dependencies when called from a test context?

By the way it seems that the docs/comments of webmockr::enable() & of onLoad() aren't up-to-date

#' each adapter (currently only \pkg{crul}), as a result of running

## because it's the only http lib supported for now

maelle added a commit to jumpingrivers/HIBPwned that referenced this issue Oct 30, 2018
@maelle
Copy link
Member Author

maelle commented Oct 30, 2018

And it seems the other failure we're getting in a test after this one

https://travis-ci.org/lockedata/HIBPwned/jobs/447952505#L1753

is also due to webmockr, because the webmockr::disable() from this test hadn't worked.

@maelle
Copy link
Member Author

maelle commented Oct 30, 2018

I thought a quick fix would be for me to add httr in the Travis config file

jumpingrivers/HIBPwned@367a216...2b00dae

which means httr was installed https://travis-ci.org/lockedata/HIBPwned/jobs/448222146#L1001

But it wasn't enough https://travis-ci.org/lockedata/HIBPwned/builds/448222145, same failures as before. Therefore, for now I put httr under Suggests. Weird.

@maelle
Copy link
Member Author

maelle commented Oct 30, 2018

Not weird at all actually travis-ci/travis-ci#4641 (comment)

I could also skip the webmockr test but I prefer not to.

@sckott
Copy link
Collaborator

sckott commented Oct 30, 2018

thanks! having a look

@sckott
Copy link
Collaborator

sckott commented Oct 30, 2018

all the context is lost cause now those builds are passing. can you show me what the errors were?

@maelle
Copy link
Member Author

maelle commented Oct 30, 2018

It said to install httr "Please install httr". To reproduce, take that repo without httr in Suggests

@maelle
Copy link
Member Author

maelle commented Oct 30, 2018

@sckott
Copy link
Collaborator

sckott commented Oct 30, 2018

thanks

sckott added a commit that referenced this issue Nov 1, 2018
change to enable and disable to just throw message when pkg not installed
onload remains the same as it wasnt loading pkgs, just remove commented out code
wrap adapter httr egs in requireNamespace so not run when httr not avail
adjust enable/disable tests so skip if httr not installed
bump version
install httr on travis
@sckott
Copy link
Collaborator

sckott commented Nov 1, 2018

@maelle can you reinstall and try again? I think it's fixed, tried locally by removing httr from suggests in the pkg and it seemed to work

@maelle
Copy link
Member Author

maelle commented Nov 1, 2018

Thanks, trying now 🤞

@maelle
Copy link
Member Author

maelle commented Nov 1, 2018

Yay it works! https://travis-ci.org/lockedata/HIBPwned/builds/449196009 Thank you!

@sckott sckott closed this as completed Nov 1, 2018
@sckott sckott added the bug label Nov 1, 2018
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