Skip to content

Commit

Permalink
Merge pull request #99 from rapidsurveys:dev
Browse files Browse the repository at this point in the history
re-organise report_op_pdf; fix #98
  • Loading branch information
ernestguevarra authored Jan 18, 2025
2 parents 358860f + 93263fc commit 8df8ebd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-tinytex@v2
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
extra-packages: any::covr, any::xml2
needs: coverage

- uses: r-lib/actions/setup-tinytex@v2
env:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX

- name: Test coverage
run: |
cov <- covr::package_coverage(
Expand Down
9 changes: 4 additions & 5 deletions R/08-report.R
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,6 @@ report_op_pdf <- function(estimates,
filename = "ramOPreport",
title = "RAM-OP Report",
view = FALSE) {
## Check if tinytex installed ----
if (!tinytex::is_tinytex()) tinytex::install_tinytex()

## Create Rmd report file
withr::with_options(
new = list(width = 80),
Expand Down Expand Up @@ -1214,8 +1211,10 @@ report_op_pdf <- function(estimates,
)

## Render document in HTML format
rmarkdown::render(input = paste(filename, ".Rmd", sep = ""),
output_format = "pdf_document")
rmarkdown::render(
input = paste(filename, ".Rmd", sep = ""),
output_format = "pdf_document"
)

## Check if report is to be viewed
if (view) {
Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/test-10-report.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ test_that("output file exists", {
})


report_op_pdf(
estimates = estimate_op(
x = indicators.ALL, w = testPSU, replicates = 19),
svy = testSVY, filename = paste(tempdir(), "pdfReport", sep = "/"
)
)

test_that("output file exists", {
skip_on_cran()
report_op_pdf(
estimates = estimate_op(
x = indicators.ALL, w = testPSU, replicates = 19),
svy = testSVY, filename = paste(tempdir(), "pdfReport", sep = "/"
)
)
expect_true(file.exists(paste(tempdir(), "pdfReport.pdf", sep = "/")))
expect_true(file.exists(paste(tempdir(), "pdfReport.Rmd", sep = "/")))
})

0 comments on commit 8df8ebd

Please sign in to comment.