-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Include break time in timings #455
Conversation
I did not test this!
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.
Thank you for this, @bencomp!
This is failing in part due to #457, but will be fixed once we merge in #458. The other reason why it would fail is because coerce_integer()
sets a default of -5
(in R, bare numbers are usually floats and integers are written with an "L" following them to indicate a "long" integer, though that's not necessarily true anymore.... it's weird, I know) so that we can find the negative numbers and report missing items.
Once the suggestion is merged, it will pass checks and I will add a new test here to check that adding a break item will work. Once that happens, I will release it.
sandpaper/tests/testthat/test-get_syllabus.R
Lines 35 to 54 in 6989c39
test_that("episodes missing question blocks and timings do not throw error", { | |
writeLines( | |
"---\ntitle: Break\nteaching: XX\n---\n\nThis should not error.", | |
fs::path(tmp, "episodes", "break.md") | |
) | |
set_episodes(tmp, c(get_episodes(tmp), "break.md"), write = TRUE) | |
(res <- get_syllabus(tmp, questions = TRUE)) %>% | |
expect_warning("No section called 'questions'") %>% | |
expect_warning("missing timings from 1 episode") | |
expect_equal(nrow(res), 4) | |
expect_equal(res$timings, c("00h 00m", "00h 12m", "00h 24m", "00h 34m")) | |
expect_equal(res$percents, c("0", "35", "71", "100")) | |
expect_equal(res$episode, c("introduction", "postroduction", "Break", "Finish")) | |
expect_equal(fs::path_file(res$path), c("introduction.html", "postroduction.html", "break.html", "")) | |
expect_equal(res$questions, c(rep(q, 2), "", "")) | |
}) |
PS, I promise I will get to your other PRs 😬
Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Thanks for your comments and help, @zkamvar! I had looked at the tests, but don't fully understand them yet – do they run in order and not reset to a default state between tests, or is there more magic going on with these unit tests? |
No worries :) |
As the code highlighting suggested, |
Since `break` is a keyword, referencing `yaml$break` broke... Co-authored-by: Zhian N. Kamvar <zkamvar@gmail.com>
Thank you for this! I'm getting a green light on https://github.com/carpentries/sandpaper/actions/runs/4995718012/jobs/8948100405?pr=455, so that means that all the tests pass with the state of the world as it is today.
Good question! The tests under For this particular file, the tests are dependent on one another (e.g. another test below this one needs to acknowledge that there is a break episode and adjust the expected timings accordingly). Because all of the tests need to work with a lesson, the first script to run is Each test file will reset the lesson and run the tests from top to bottom. In this way, the tests within a file are somewhat dependent on one another because they explicitly work on the lesson files. I have attempted to minimize this, but there are some times when the side-effects were necessary. |
If my naive change works, this fixes #437. However, I did not test this!