-
Notifications
You must be signed in to change notification settings - Fork 38
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
Streamlined setting environment variables into setup_ckanr, superseding set_test_env #37
Conversation
… checks in tests; added test settings to ckan_settings
Ok, this is starting to become a major update - thanks to @wush978 things are now clearer and more consistent but in the course of this refactoring I've had to touch
# Scott Chamberlain @ data-demo
setup_ckanr(test_url="http://data-demo.dpaw.wa.gov.au/",
test_key="scotts-test-key",
test_did="ae6fdf6f-1435-444b-b319-198cc84e4594",
test_rid="0155c395-842d-4b66-a72c-c6e688b260c3",
test_gid="templates-and-guidelines",
test_oid="sandbox",
test_behaviour="FAIL")
devtools::test() Looking forward to constructive feedback! |
res <- content(res, "text") | ||
switch(as, json = res, list = jsl(res), table = jsd(res)) | ||
switch(as, json=res, list=jsl(res), table=jsd(res)) |
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.
@florianm can you undo these changes to spacing around =
signs? I think many agree that code is more readable with spaces in appropriate places. In all places you changed
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.
Yelp... OK I'l bring them back! I went with the Google R style guide which finds spaces being optional for function parameters. Agree with Hadley's "always spaces around infix operators".
In the future, smaller pull requests that are focused around a single theme, would be easier to manage. I made a comment about white spaces and parameter newlines. I'd like it if you could undo those changes. We generally follow http://adv-r.had.co.nz/Style.html Thoughts @wush978 |
I check this PR on windows but it fails:
A minor concern: I do not suggest to use: url <- get_test_url()
key <- get_test_key()
rid <- get_test_rid()
resource_update(rid, path=path, url=url, key=key) Because this kind of test does not coverage the real use case: setup_ckanr(url="http://data.techno-science.ca/", key="my-ckan-api-key")
resource_update(rid, path=path) |
#' # Not specifying the default CKAN URL will reset the CKAN URL to its default | ||
#' # "http://data.techno-science.ca/": | ||
#' setup_ckanr() | ||
setup_ckanr <- function( |
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.
@florianm I would suggest making this function to set settings the same name format as the function to get settings: So ckanr_setup
and ckanr_settings
, that okay?
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.
That would be even more consistent, will do!
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.
great 👍
@wush978 you have to set a few env vars - see #37 (comment) After setting those, tests did pass for me locally |
Hi all,
Thanks for the feedback, I'll get to incorporate all of your requests
hopefully on Monday! They all make sense.
With the latest status quo, do we need a separate test url and key, or
should tests set and implicitly/explicitly use the default url and key?
Cheers and thanks for the review,
Florian
|
@florianm wrt putting each param on a separate line - I imagine you did so so it's easier to run default params to work on the function? I totally understand that. That's why I use this https://github.com/sckott/sacbox/blob/master/R/load_defaults.r I just load that on every R session, so that I can load default params for a function I'm working on, and don't need to run one at a time. |
I guess CKAN is a little different from other things in that a user could potentially be a developer/data provider and want to test against different servers with different auth settings. So maybe it makes sense to set different settings for test server |
Thanks for the feedback, good points!
ckanr_setup(url="sdfsdf", key="sdfsf") while testers would run (if we simplify the parameter names): ckanr_setup(url="test ckan", key="test key", did="test ds id", rid="test res id", gid="test group name",
oid="test org id", test_behaviour="FAIL")
# testing whether function defaults to ckanr_settings correctly:
x <- do_something() # defaulting to get_{url, key, did, rid, gid, oid}()
# testing with explicit parameters
y <- do_something(url=get_url(), key=get_key(), did=get_did(), rid=get_rid(), gid=get_gid(), oid=get_oid())
So, last question to you @sckott and @wush978 : Should I keep DEFAULT and TEST url and key separate, or merge and simplify? If we merge, what parameter names would be the best (should I drop the "test_")? Is there a shorter name for "test_behaviour"? |
…" and "paging" params "offset" and "limit" together
Formatting clean-up is done, tests pass with Scott's settings on data-demo.dpaw.wa.gov.au. Pending my actions on whether to keep or merge default and test url/key, this PR is nearing completion. |
Sorry that I cannot closely check these codes. I will check them on the weekend. |
@florianm I think this is good. Mind if I merge now? |
All good from my side, and if you and Wush feel merging default and test url/key would be appropriate I can still do so in a new PR. |
Yeah, I'd like to get this merged - and we can make additional changes after merging - if needed |
Streamlined setting environment variables into setup_ckanr, superseding set_test_env
Dear @florianm , I think dropping |
@florianm merge what? this is already merged |
Sorry - I meant url and key default and test settings (along these lines)! |
@florianm yes, plz do. regarding style - in ropensci pkgs we try to maintain a similar style across pkgs for consistency within ropensci. totally fine with other styles, but we just want to maintain consistency within our suite as much as possible |
Following up on discussion of #31 - first cut - @sckott @wush978 what do you think?