Skip to content

Commit

Permalink
merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Nov 15, 2024
2 parents a8dbcfc + 471d064 commit bfccf76
Show file tree
Hide file tree
Showing 127 changed files with 2,244 additions and 1,087 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ inst/ignore
^use_vcr_notes.txt$
^docs$
^make_readme.R$
^LICENSE\.md$
66 changes: 13 additions & 53 deletions .github/workflows/R-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,78 +13,38 @@ jobs:
matrix:
config:
- { os: windows-latest, r: 'release'}
- { os: windows-latest, r: 'devel'}
- { os: macOS-latest, r: 'release'}
- { os: macOS-latest, r: 'devel'}
- { os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- { os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- { os: ubuntu-22.04, r: 'release'}
- { os: ubuntu-22.04, r: 'devel'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
CRAN: ${{ matrix.config.rspm }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ steps.install-r.outputs.installed-r-version }}-1-
extra-packages: any::rcmdcheck
needs: check

- name: Install pak
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
shell: Rscript {0}

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(pak::local_system_requirements("ubuntu", "16.04"))')
- name: Install dependencies
run: |
pak::local_install_dev_deps()
pak::pkg_install(c("rcmdcheck", "jpeg"))
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true

- name: Show testthat output
if: always()
run: find check -name 'test-all.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

- name: Test coverage
if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.r == 'release'
run: |
Rscript -e 'install.packages("covr")' -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'
33 changes: 11 additions & 22 deletions .github/workflows/revdep-check.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
on: push

name: revdep

jobs:
revdep:
runs-on: ${{ matrix.config.os }}
runs-on: ubuntu-22.04
if: startsWith(github.event.head_commit.message, 'REVDEPCHECK')
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: ubuntu-22.04 (release)
strategy:
fail-fast: false
matrix:
config:
- { os: macOS-latest, r: 'latest'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
CRAN: ${{ matrix.config.cran }}
GITHUB_PAT: ${{ secrets.GH_PAT }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
r-version: release

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- name: Cache R packages
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }}

- name: Install dependencies
run: Rscript -e "install.packages('remotes')" -e "remotes::install_deps(dependencies = TRUE)" -e "remotes::install_github('r-lib/revdepcheck')"
- uses: r-lib/actions/setup-r-dependencies@v2

- name: Revdepcheck
run: Rscript -e "revdepcheck::revdep_reset()" -e "revdepcheck::revdep_check(num_workers=4)"
run: Rscript -e "install.packages('remotes')" -e "remotes::install_github('r-lib/revdepcheck')" -e "revdepcheck::revdep_reset()" -e "revdepcheck::revdep_check(num_workers=4)"

- name: Upload revdepcheck results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
name: ubuntu-22-04-r-release-results
path: revdep/*.md
30 changes: 16 additions & 14 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,51 @@ Description: Record test suite 'HTTP' requests and replays them during
real 'HTTP' responses on disk in 'cassettes'. Subsequent 'HTTP' requests
matching any previous requests in the same 'cassette' use a cached
'HTTP' response.
Version: 0.6.4.91
Version: 1.6.0.91
Authors@R: c(person("Scott", "Chamberlain", role = c("aut", "cre"),
email = "sckott@protonmail.com",
comment = c(ORCID="0000-0003-1444-9135")),
person("Aaron", "Wolen", role = "ctb",
person("Aaron", "Wolen", role = "aut",
comment = c(ORCID="0000-0003-2542-2202")),
person("Maëlle", "Salmon", role = "ctb",
person("Maëlle", "Salmon", role = "aut",
comment = c(ORCID="0000-0002-2815-0399")),
person("Daniel", "Possenriede", role = "aut",
comment = c(ORCID="0000-0002-6738-9845")),
person("rOpenSci", role = "fnd", comment = "https://ropensci.org"))
URL: https://github.com/ropensci/vcr/ (devel)
https://books.ropensci.org/http-testing/ (user manual)
URL: https://github.com/ropensci/vcr/,
https://books.ropensci.org/http-testing/,
https://docs.ropensci.org/vcr/
BugReports: https://github.com/ropensci/vcr/issues
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-US
LazyData: true
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
SystemRequirements: C++11
LinkingTo:
cpp11
Imports:
curl,
crul (>= 0.8.4),
httr,
webmockr (>= 0.7.4.95),
httr2,
webmockr (>= 0.8.0),
urltools,
yaml,
R6,
base64enc,
here
rprojroot
Suggests:
roxygen2 (>= 7.0.2),
roxygen2 (>= 7.2.1),
jsonlite,
testthat,
knitr,
rmarkdown,
desc,
crayon,
cli,
withr
Remotes: ropensci/webmockr@httr-url-redirects
withr,
webfakes
Remotes: ropensci/webmockr@redirects
X-schema.org-applicationCategory: Web
X-schema.org-keywords: http, https, API, web-services, curl, mock, mocking, http-mocking, testing, testing-tools, tdd
X-schema.org-isPartOf: https://ropensci.org
RoxygenNote: 7.1.1
RoxygenNote: 7.3.2
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2020
YEAR: 2022
COPYRIGHT HOLDER: Scott Chamberlain
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2022 Scott Chamberlain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ doc:
${RSCRIPT} -e "devtools::document()"

eg:
${RSCRIPT} -e "devtools::run_examples()"
${RSCRIPT} -e "devtools::run_examples(run_dontrun=TRUE)"

test:
${RSCRIPT} -e "devtools::test()"
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export(Request)
export(RequestHandler)
export(RequestHandlerCrul)
export(RequestHandlerHttr)
export(RequestHandlerHttr2)
export(RequestMatcherRegistry)
export(Serializers)
export(UnhandledHTTPRequestError)
Expand Down Expand Up @@ -56,11 +57,12 @@ importFrom(crul,mock)
importFrom(curl,handle_setopt)
importFrom(httr,content)
importFrom(httr,http_status)
importFrom(httr2,req_perform)
importFrom(httr2,resp_status_desc)
importFrom(urltools,url_compose)
importFrom(urltools,url_parse)
importFrom(utils,getParseData)
importFrom(webmockr,pluck_body)
importFrom(yaml,as.yaml)
importFrom(yaml,yaml.load)
importFrom(yaml,yaml.load_file)
useDynLib(vcr, .registration = TRUE)
99 changes: 97 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,98 @@
vcr 1.6.0
=========

### NEW FEATURES

* `vcr` now supports `httr2` in addition to `httr` and `crul`. (#237) (#268)
* `vcr` now supports async http requests with `crul` (w/ `crul` v1.5 or greater). no change was required in `vcr` for this to happen. a PR was merged in `crul` to hook into `vcr`. there's no support for async in `httr` as that package does not do any async and no support in `httr2` because `req_perform_parallel` does not have a mocking hook as does `req_perform` (#246)

### BUG FIXES

* Ports in URLs (e.g., 8000) were being accidentally stripped. Fixed now (#264) (#266)

### MINOR IMPROVEMENTS

* Add link to DESCRIPTION file for packge documentation. thanks @olivroy (#265)
* Use `_PACKAGE` syntax for package level doc (#263)


vcr 1.2.2
=========

* change tests to use more reliable test servers

vcr 1.2.0
=========

### NEW FEATURES

* Added @dpprdan as an author; changed all ctb to aut (#258)

### MINOR IMPROVEMENTS

* `use_vcr()` now creates a test helper file called `helper-vcr.R` instead of `setup-pkgname.R`.
We are reverting the change from version 0.6.0 and now recommend the use of `helper-*.R` again, so that the vcr setup [is loaded with `devtools::load_all()`](https://testthat.r-lib.org/reference/test_dir.html#special-files).
That way your vcr-enabled tests also work when run interactively (#244) (#256)
* default git branch changed from master to main (#253)
* update example packages in the README (#257)
* vcr no longer requires compilation because replaced the single C++ function with a pure R equivalent

### BUG FIXES

* roll back a change from the previous CRAN version that removed use of an internal function (`body_from`) (#249) (#252)

vcr 1.1.0
=========

### MINOR IMPROVEMENTS

* request matching was sensitive to escaping special characters, that's been fixed (#240) (#247) thanks to @KevCaz
* fix broken link given in error suggestion (#239) thanks to @maelle
* using `preserve_exact_body_bytes = TRUE` now writes a base64 encoded string into a field in yaml or json on disk called `base64_string`. When `preserve_exact_body_bytes = FALSE` (the default) the response body goes into a field called `string`

### BUG FIXES

* `vcr_test_path` fix to find root package path correctly with R 4.2 on Windows (#242) (#243) thanks to @dpprdan

vcr 1.0.2
=========

### BUG FIXES

* fix to `vcr_test_path()` to find root package path correctly (#235) (#236)

vcr 1.0.0
=========

### NEW FEATURES

* `check_cassette_names()` gains `allowed_duplicates` parameter to allow duplicate cassette names; we typically advise users not to use duplicate cassette names, but there are cases where you may want to share cassettes across tests (#227)
* `vcr_configure()` gains `filter_query_parameters` parameter for filtering out query parameters so they don't show up in the recorded request on disk (#212)
* `use_vcr()`: now sets a mimimum vcr version, which is usually the latest (stable) version on CRAN. You can of course easily remove or change the version requirement yourself after running it (#214)
* `vcr_configure()` gains `warn_on_empty_cassette` parameter: Should a warning be thrown when an empty cassette is detected? Empty cassettes are cleaned up (deleted) either way (#224) thanks @llrs and @dpprdan
* `vcr_configure()` gains `quiet` parameter: suppress any messages from both vcr and webmockr (#226) (#25)
* `vcr_configure()` gains new option `filter_sensitive_data_regex`; now `filter_sensitive_data` is for fixed string matching, while `filter_sensitive_data_regex` is for regex based matching (#222) thanks @tomsing1 for reporting
* gains package import `rprojroot`

### MINOR IMPROVEMENTS

* `filter_sensitive_data` option now strips leading and trailing single and double quotes from strings before being used IN CASE a user accidentally quotes a secret - logic being that even though a secret may have a single or double quote in it, its very unlikely that it would have both a leading and trailing quote (single or double) (#221)

### Documentation

* new vignette explaining the design of the vcr package (also can be found in the HTTP Testing book) (#232) (#233)
* no user facing change - but vignettes moved into man/rmdhunks so that they can be pulled into the HTTP Testing book easily (#209) (#216)
* fix in configuration vignette to clarify a `filter_request_headers` example (#215) thanks @maelle
* docs update (#33) (#217)

### BUG FIXES

* `filter_request_headers` was unfortunately adding a request header to the request written to disk when the header did not exist; now fixed (#213)
* bug in internal function `is_base64()`; `strsplit()` needed `useBytes=TRUE` (#219)
* `filter_sensitive_data` was not working when strings contained regex characters; fixed, and see also above new config variable for regex specific filtering (#222) thanks @tomsing1 for reporting
* `vcr_test_path()` should now correctly set paths (#225) (#228) (#229) (#230)


vcr 0.6.0
=========

Expand Down Expand Up @@ -132,12 +227,12 @@ vcr 0.2.6
## NEW FEATURES

* gains function `use_vcr()` to setup `vcr` for your package. This requires 3 pkgs all in Suggests; so are not required if you don't need to use `use_vcr()` (#52) (#95) thanks @maelle for the feedback!
* `vcr` actually supports all four recording modes: `none`, `once`, `new_episodes`, and `all`. `once` is what's used by default. See `?recording` for description of the recording modes. For now [the test file test-ause_cassette_record_modes.R](https://github.com/ropensci/vcr/blob/master/tests/testthat/test-ause_cassette_record_modes.R) gives some examples and what to expect for each record mode; in the future the http testing book will have much more information in the _Record modes_ chapter <https://books.ropensci.org/http-testing/record-modes.html> ([commit](https://github.com/ropensci/vcr/commit/04aa5f784b18308d8f62d1b6b0be2f3e140f2a5a))
* `vcr` actually supports all four recording modes: `none`, `once`, `new_episodes`, and `all`. `once` is what's used by default. See `?recording` for description of the recording modes. For now [the test file test-ause_cassette_record_modes.R](https://github.com/ropensci/vcr/blob/main/tests/testthat/test-ause_cassette_record_modes.R) gives some examples and what to expect for each record mode; in the future the http testing book will have much more information in the _Record modes_ chapter <https://books.ropensci.org/http-testing/record-modes.html> ([commit](https://github.com/ropensci/vcr/commit/04aa5f784b18308d8f62d1b6b0be2f3e140f2a5a))

### MINOR IMPROVEMENTS

* lots of tidying for better/consistent style
* fix for a partial argument call in `as.list()`: `all` to `all.names` ([commit](https://github.com/ropensci/vcr/commit/b20a2d5ffd0f65175dee4d84aa9573f3652df1d2))
* fix for a partial argument call in `as.list()`: `all` to `all.names`

### BUG FIXES

Expand Down
Loading

0 comments on commit bfccf76

Please sign in to comment.