[education/rkward] /: Update tests

Thomas Friedrichsmeier null at kde.org
Fri May 13 22:39:21 BST 2022


Git commit 72a10314f322839e065a696b1644e3c20ed2765b by Thomas Friedrichsmeier.
Committed on 13/05/2022 at 21:39.
Pushed by tfry into branch 'master'.

Update tests

M  +0    -1    ChangeLog
M  +6    -1    tests/import_export_plugins.R
A  +9    -0    tests/import_export_plugins/git_install.messages.txt
A  +10   -0    tests/import_export_plugins/git_install.rkcommands.R
D  +0    -3    tests/import_export_plugins/import_generic_rio.messages.txt

https://invent.kde.org/education/rkward/commit/72a10314f322839e065a696b1644e3c20ed2765b

diff --git a/ChangeLog b/ChangeLog
index 268c7dff..7c6bde6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,6 @@ TODOs:
 - When directly upgrading from very old versions (pre 0.6.3, currently), discard existing config settings
 - Plugin maps with the same id are grouped together, and the most recent version is used, automatically
 - Added functionality to install add-on packages directly from git (formerly available as external plugin rk.gitInstall)
-   - TODO: add a plugintest
 - Fixed: Disabling a <row> element in plugins would not make the sub-elements non-required
 - Add option to show ANOVA table for linear regression
 - Add default preview() function is available to plugins, reducing the code needed to add preview functionality
diff --git a/tests/import_export_plugins.R b/tests/import_export_plugins.R
index 331398ca..1e0570ef 100644
--- a/tests/import_export_plugins.R
+++ b/tests/import_export_plugins.R
@@ -62,7 +62,7 @@ suite <- new ("RKTestSuite", id="import_export_plugins",
 			# In order to check, whether the import was correct
 			rk.print (my.rio.data)
 			for (var in my.rio.data) rk.print (rk.get.description(var))
-		}, libraries=c("foreign"), files=c("../import_export_plugins_testfile.sav")),
+		}, libraries=c("rio"), files=c("../import_export_plugins_testfile.sav")),
 		new ("RKTest", id="import_stata", call=function () {
 			rk.call.plugin ("rkward::import_stata", convert_dates.state="1", convert_factors.state="1", convert_underscore.state="0", do_locale_conversion.state="1", doedit.state="0", encoding.string="ISO8859-1", file.selection=file.path (getwd(), "import_export_plugins_testfile.dta"), missing_type.state="0", saveto.objectname="my.stata.data", saveto.parent=".GlobalEnv", submit.mode="submit")
 
@@ -131,6 +131,11 @@ suite <- new ("RKTestSuite", id="import_export_plugins",
 			for (line in x) rk.print (line)
 			unlink(file)
 		}),
+		new ("RKTest", id="git_install", call=function () {
+			# Intentionally using a non-existent path, as we do not want to install a package. This test still allows to check that the generated code remains as expected
+			# (note: plugin linked from internal help pages!)
+			rk.call.plugin ("rkward::install_from_git", fullURL.text="https://github.com/does/not/exist/404.git", submit.mode="submit")
+		}, libraries=c("devtools", "usethis")),
 		new ("RKTest", id="package_skeleton", call=function () {
 			# create two functions to use
 			assign ("skel.func1", rkwardtests::rktest.getTempDir, envir=globalenv())
diff --git a/tests/import_export_plugins/git_install.messages.txt b/tests/import_export_plugins/git_install.messages.txt
new file mode 100644
index 00000000..a52c606c
--- /dev/null
+++ b/tests/import_export_plugins/git_install.messages.txt
@@ -0,0 +1,9 @@
+Warning in system(full, intern = TRUE, ignore.stderr = quiet) :
+  running command ''/usr/bin/git' ls-remote https://github.com/does/not/exist/404.git  2>/dev/null' had status 128
+Warning in system(full, intern = TRUE, ignore.stderr = quiet) :
+  running command ''/usr/bin/git' ls-remote https://github.com/does/not/exist/404.git  2>/dev/null' had status 128
+Error: Failed to install 'unknown package' from Git:
+  Command failed (128)
+In addition: Warning message:
+In .rk.do.call("doPlugin", callstrings) :
+  Not all specified settings could be applied. Most likely this is because some R objects are no longer present in your current workspace.
diff --git a/tests/import_export_plugins/git_install.rkcommands.R b/tests/import_export_plugins/git_install.rkcommands.R
new file mode 100644
index 00000000..d6b80086
--- /dev/null
+++ b/tests/import_export_plugins/git_install.rkcommands.R
@@ -0,0 +1,10 @@
+local({
+## Prepare
+require(devtools)
+## Compute
+  install_git(
+    url="https://github.com/does/not/exist/404.git"
+  )
+## Print result
+rk.header ("Install from git results")
+})
diff --git a/tests/import_export_plugins/import_generic_rio.messages.txt b/tests/import_export_plugins/import_generic_rio.messages.txt
deleted file mode 100644
index f7858fc0..00000000
--- a/tests/import_export_plugins/import_generic_rio.messages.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Loading required package: rio
-The following rio suggested packages are not installed: 'arrow', 'feather', 'fst', 'hexView', 'pzfx', 'readODS', 'rmatio'
-Use 'install_formats()' to install them


More information about the rkward-tracker mailing list