-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
disable lockfile generation in callr
, testthat::tests
and R CMD CHECK
#1346
disable lockfile generation in callr
, testthat::tests
and R CMD CHECK
#1346
Conversation
It does seem to work. I've checked |
Will try to build in a sec
Does if (interactive()) {
shinyApp(ui, server)
} When I run |
Sorry for the delay, I needed to install Quarto, |
Then edit: sorry you run with |
For I hope I will get quarto book rendered sorted out during this time. For now I am experiencing an issue with the installation of GitHub packages. |
Ok, for |
In this PR we try to disable one of the functionalities of teal, which is lockfile creation. We listed out scenarios in which we would like to disable the option #1276 (comment) We are trying to figure out what elements are covered in tlg-catalog Quarto book creation so that at some parts this feature can be disabled as well. I am trying to figure out the flow of Quarto (that uses webR and uses shinylive) for tlg-catalog rendering. Would you be able to help me explain the process? Based on the example:
here is what I understand is happening in tlg-catalog. Quarto is used to render the whole book/website. There are tabs that just have data preparations and plot generation - those have a preview section and webR section. There is also a tab called So for the app that is started in shinylive section, we would like to show teal lockfile. However for the moment when the Quarto page is generated/rendered and the screenshot for the preview section is made, we would not like to create a lockfile. I am trying to figure out how the screenshot is made, and whether we needed to run the teal app to create the screenshot. I understand that screenshot is made with If the teal app is run inside Quarto process just to create the screenshot, we can easily detect that Quarto is running by checking |
I share the same understanding. And yes - the app needs to be run to get the snapshot. Unfortunately I don't know ow the details of this. This is also not well documented and I even created a ticket to enhance the docs in the knitr repo |
Ok, I think I was able to understand the process based on a small test Quarto file with teal app. Quarto renders the file and starts teal app, once the chunk is finished it is possible to create a snapshot/webshot of the app that was run. You can see in the logs that the whole app was run. So to omit teal lockfile creation during tlg-creation we need to disable it based on a Quarto running flag EDIT THIS MESSAGE TO COPY THE CONTENT OF THE BELOW FILE title: Test
|
Yeah, for Quarto you can see it was possible to disable lockfile with the last commit d54cb80 Without the flag it was running the lockfile![]() With the flag it is not running the lockfile![]() |
R/zzz.R
Outdated
lockfile_flag <- | ||
!( | ||
identical(Sys.getenv("CALLR_IS_RUNNING"), "true") || # inside callr process | ||
identical(Sys.getenv("TESTTHAT"), "true") || # inside devtools::test |
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.
a question
what would happen if we do load_all()
and then test()
?
Do I understand correctly that the option would be set to true and then lockfile created inside the tests?
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.
Let me check, good question
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.
I actually think that Sys.getenv("TESTTHAT")
flag is set after the package is loaded during tests, and the initial value of getOption('teal.lockfile.enable')
is set to TRUE
during tests. Not as I would expect it to work
I added this snippet to check the behavior of this flag during checks.
cat('\n teal.lockfile.enable: ', getOption('teal.lockfile.enable'), '\n')
This made me think we actually need to disable the creation of the lockfile inside srv_teal_lockfile
, if Sys.getenv("TESTTHAT")
gets set later after the package is loaded
![image](https://private-user-images.githubusercontent.com/133694481/368580365-934368ee-0dfa-4337-ac1a-f42f4ca0be3a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzQ2MDkwMDMsIm5iZiI6MTczNDYwODcwMywicGF0aCI6Ii8xMzM2OTQ0ODEvMzY4NTgwMzY1LTkzNDM2OGVlLTBkZmEtNDMzNy1hYzFhLWY0MmY0Y2EwYmUzYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMjE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTIxOVQxMTQ1MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04N2QwZDE0OGJhNTNiN2FkODhmNWU1Nzc2Mjg1M2Y2OWNhY2RmZjA1ZWU5ZDUzZTU3NDU2NDBlZDkyM2I1MDc5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.BPFESrG1n7HB1hPOxNB9D3Vu6MQhL0tzQtfoucawLR8)
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.
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.
This made me think we actually need to disable the creation of the lockfile inside srv_teal_lockfile, if Sys.getenv("TESTTHAT") gets set later after the package is loaded
I got a similar idea. And I was thinking about this particular example in my previous comment here
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.
With this commit 1862043 I moved the functionality inside srv_teal_lockfile
so the checks are made on lockfile execution.
If the option was set before the lockfile was called, then the option is superior to the circumstances check
Current state of test ══ Results ══════════════════════════════════════════════════════════════════════════════
Duration: 564.7 s
── Skipped tests (6) ────────────────────────────────────────────────────────────────────
• need a fix in a .slicesGlobal (1): test-module_teal.R:1139:11
• todo (5): test-module_teal.R:1404:7, test-module_teal.R:1411:5,
test-module_teal.R:1414:5, test-module_teal.R:1673:5, test-module_teal.R:1731:5
[ FAIL 0 | WARN 0 | SKIP 6 | PASS 515 ] |
I've tested using
I didn't check tlg-catalog. NOTE: In |
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.
Let's continue on the feature branch
Alrighty, merging into feature branch |
Part of #1263 and closes #1276
Local results of
shinytest2
tests