[education/rkward] tests: Fix false positive in plugintests
Thomas Friedrichsmeier
null at kde.org
Thu May 1 10:10:58 BST 2025
Git commit 8d525640294cb27c89290b04f2b02f7f9b51d891 by Thomas Friedrichsmeier.
Committed on 01/05/2025 at 09:10.
Pushed by tfry into branch 'master'.
Fix false positive in plugintests
M +12 -8 tests/rkward_application_tests.R
M +2 -0 tests/rkward_application_tests/active_binding.messages.txt
https://invent.kde.org/education/rkward/-/commit/8d525640294cb27c89290b04f2b02f7f9b51d891
diff --git a/tests/rkward_application_tests.R b/tests/rkward_application_tests.R
index f06a8cbf5..113959c0d 100644
--- a/tests/rkward_application_tests.R
+++ b/tests/rkward_application_tests.R
@@ -16,15 +16,19 @@ suite <- new ("RKTestSuite", id="rkward_application_tests",
), tests = list (
new ("RKTest", id="active_binding", call=function () {
.GlobalEnv$active.binding.value <- 1
- makeActiveBinding ("active.binding", function () { message ("active.binding"); .GlobalEnv$active.binding.value }, .GlobalEnv)
+ makeActiveBinding("active.binding", function () { message ("active.binding"); .GlobalEnv$active.binding.value }, .GlobalEnv)
+ message("before sync")
+ rk.sync.global() # NOTE: This will currently create two "active.binding"-messages, one for the binding being copied to the shadow env,
+ # and one for the frontend syncing info about the symbol.
+ # That's an implementation detail, and could reasonably change, i.e. a failure to match the exact messages is
+ # not necessarily an error. It just needs careful review.
+ # The further tests, below, *are* critical, however
+ message("after sync")
- rk.sync.global ()
- message ("after sync")
-
- stopifnot (.GlobalEnv$active.binding == .GlobalEnv$active.binding.value)
+ stopifnot(.GlobalEnv$active.binding == .GlobalEnv$active.binding.value)
.GlobalEnv$active.binding.value <- 123
- stopifnot (.GlobalEnv$active.binding == 123)
+ stopifnot(.GlobalEnv$active.binding == 123)
# NOTE: the message "active.binding" should be displayed in the message output
}),
@@ -269,9 +273,9 @@ suite <- new ("RKTestSuite", id="rkward_application_tests",
}, libraries=c ("lattice")),
new ("RKTest", id="device_capturing_stress_test", call=function () {
# This test checks for the "figure margins too large" error, that used to occur when plotting on a fresh device, sometimes.
- # Since the error only appeared occasionally, we try 100 times to produce it. Unfortunately, that does make the test run annoyingly long...
+ # Since the error only appeared occasionally, we used to try 100 times to produce it, but that does made the test run annoyingly long...
graphics.off()
- for (i in 1:100) {
+ for (i in 1:10) {
rk.embed.device (grDevices::x11())
plot (rnorm (100), main=paste (i, "/ 100"))
dev.off ()
diff --git a/tests/rkward_application_tests/active_binding.messages.txt b/tests/rkward_application_tests/active_binding.messages.txt
index d7ce6e8ca..a3beaa137 100644
--- a/tests/rkward_application_tests/active_binding.messages.txt
+++ b/tests/rkward_application_tests/active_binding.messages.txt
@@ -1,3 +1,5 @@
+before sync
+active.binding
active.binding
after sync
active.binding
More information about the rkward-tracker
mailing list