ropensci / RNeXML

Implementing semantically rich NeXML I/O in R
https://docs.ropensci.org/RNeXML
Other
13 stars 9 forks source link

Various test failures with devtools::test() #183

Closed hlapp closed 5 years ago

hlapp commented 5 years ago

Although tests seem to be passing with R CMD check (including locally), there are a variety of failures with devtools::test(), which is the command that the "Test package" command in RStudio runs.

I don't understand why the difference, but it's a little troubling.

Output from the failures follows. (The output is modified from the original. Specifically, I removed various warnings, reports on successful tests, and left only the failures.)

Testing RNeXML
✖ |  7 5     | ape [2.5 s]
test_ape.R:30: error: From nexml to multiPhylo
'names' attribute [2] must be the same length as the vector [0]
1: expect_warning(phy <- as(nexml, "phylo"), "Multiple trees found, Returning multiPhylo object") at /Users/lapp/Projects/RNeXML/tests/testthat/test_ape.R:30
2: quasi_capture(enquo(object), capture_warnings, label = label)
3: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
4: withCallingHandlers(code, warning = function(condition) {
       out$push(condition)
       invokeRestart("muffleWarning")
   })
5: eval_bare(get_expr(quo), get_env(quo))
6: as(nexml, "phylo")
7: asMethod(object)
8: as(from, "multiPhylo") at /Users/lapp/Projects/RNeXML/R/get_trees.R:106
9: asMethod(object)
10: unname(lapply(from@trees, function(X) {
       out <- unname(lapply(X@tree, toPhylo, map[[X@otus]]))
       class(out) <- "multiPhylo"
       out
   })) at /Users/lapp/Projects/RNeXML/R/get_trees.R:73
11: lapply(from@trees, function(X) {
       out <- unname(lapply(X@tree, toPhylo, map[[X@otus]]))
       class(out) <- "multiPhylo"
       out
   })
12: FUN(X[[i]], ...)
13: unname(lapply(X@tree, toPhylo, map[[X@otus]])) at /Users/lapp/Projects/RNeXML/R/get_trees.R:75
14: lapply(X@tree, toPhylo, map[[X@otus]])
15: FUN(X[[i]], ...)

test_ape.R:53: error: We can read and write NeXML to phylo and back without edge.lengths
'names' attribute [2] must be the same length as the vector [0]
1: as(nexml_read("ex.xml"), "phylo") at /Users/lapp/Projects/RNeXML/tests/testthat/test_ape.R:53
2: asMethod(object)
3: toPhylo(from@trees[[1]]@tree[[1]], maps[[otus_id]]) at /Users/lapp/Projects/RNeXML/R/get_trees.R:103

test_ape.R:66: error: Rooted trees remain rooted on conversions
'names' attribute [2] must be the same length as the vector [0]
1: expect_true(is.rooted(as(read.nexml("tmp.xml"), "phylo"))) at /Users/lapp/Projects/RNeXML/tests/testthat/test_ape.R:66
2: quasi_label(enquo(object), label)
3: eval_bare(get_expr(quo), get_env(quo))
4: is.rooted(as(read.nexml("tmp.xml"), "phylo"))
5: as(read.nexml("tmp.xml"), "phylo")
6: asMethod(object)
7: toPhylo(from@trees[[1]]@tree[[1]], maps[[otus_id]]) at /Users/lapp/Projects/RNeXML/R/get_trees.R:103

test_ape.R:75: error: Unrooted trees remain unrooted on conversions
'names' attribute [2] must be the same length as the vector [0]
1: expect_false(is.rooted(as(read.nexml("tmp.xml"), "phylo"))) at /Users/lapp/Projects/RNeXML/tests/testthat/test_ape.R:75
2: quasi_label(enquo(object), label)
3: eval_bare(get_expr(quo), get_env(quo))
4: is.rooted(as(read.nexml("tmp.xml"), "phylo"))
5: as(read.nexml("tmp.xml"), "phylo")
6: asMethod(object)
7: toPhylo(from@trees[[1]]@tree[[1]], maps[[otus_id]]) at /Users/lapp/Projects/RNeXML/R/get_trees.R:103

test_ape.R:81: error: We can convert trees with only some edge lengths into ape::phylo
'names' attribute [2] must be the same length as the vector [0]
1: expect_warning(a <- as(read.nexml(f), "phylo"), "Multiple trees found, Returning multiPhylo object") at /Users/lapp/Projects/RNeXML/tests/testthat/test_ape.R:81
2: quasi_capture(enquo(object), capture_warnings, label = label)
3: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
4: withCallingHandlers(code, warning = function(condition) {
       out$push(condition)
       invokeRestart("muffleWarning")
   })
5: eval_bare(get_expr(quo), get_env(quo))
6: as(read.nexml(f), "phylo")
7: asMethod(object)
8: as(from, "multiPhylo") at /Users/lapp/Projects/RNeXML/R/get_trees.R:106
9: asMethod(object)
10: unname(lapply(from@trees, function(X) {
       out <- unname(lapply(X@tree, toPhylo, map[[X@otus]]))
       class(out) <- "multiPhylo"
       out
   })) at /Users/lapp/Projects/RNeXML/R/get_trees.R:73
11: lapply(from@trees, function(X) {
       out <- unname(lapply(X@tree, toPhylo, map[[X@otus]]))
       class(out) <- "multiPhylo"
       out
   })
12: FUN(X[[i]], ...)
13: unname(lapply(X@tree, toPhylo, map[[X@otus]])) at /Users/lapp/Projects/RNeXML/R/get_trees.R:75
14: lapply(X@tree, toPhylo, map[[X@otus]])
15: FUN(X[[i]], ...)
─────────────────────────────────────────
✖ |  1 1     | Comparative analysis [2.6 s]
test_comp_analysis.R:9: error: We can extract tree and trait data to run fitContinuous and fitDiscrete
'names' attribute [2] must be the same length as the vector [0]
1: get_trees(nexml) at /Users/lapp/Projects/RNeXML/tests/testthat/test_comp_analysis.R:9
2: as(nexml, "phylo") at /Users/lapp/Projects/RNeXML/R/get_trees.R:38
3: asMethod(object)
4: toPhylo(from@trees[[1]]@tree[[1]], maps[[otus_id]]) at /Users/lapp/Projects/RNeXML/R/get_trees.R:103
──────────────────────────────────────────────⠏ |  6 2 2   | metaNamespace prefix xhtml on div is not defined
✖ |  9 2 2   | meta [6.0 s]
Validation failed, error messages: 
                    tree 'uuid-59ed239e-71db-42f4-8391-fbfcda72e3c9' has reticulations            Validation failed, error messages: 
                    tree 'uuid-59ed239e-71db-42f4-8391-fbfcda72e3c9' has reticulations (line 46)

test_meta.R:31: failure: We can add R bibentry type metadata
`o` isn't true.

test_meta.R:60: warning: We can add additional metadata
Validation failed, error messages: 
                    tree 'uuid-535cc64b-9185-447b-8ef6-aa9c3c774055' has reticulations            Validation failed, error messages: 
                    tree 'uuid-535cc64b-9185-447b-8ef6-aa9c3c774055' has reticulations (line 49)

test_meta.R:60: failure: We can add additional metadata
`o` isn't true.
──────────────────────────────────────────────✖ |  0 2 2   | serializing [3.5 s]
Validation failed, error messages: 
                    tree 'uuid-11851ccd-7fba-4f49-9311-49c881c0fec5' has reticulations            Validation failed, error messages: 
                    tree 'uuid-11851ccd-7fba-4f49-9311-49c881c0fec5' has reticulations (line 32)

test_serializing.R:15: failure: We can serialize ape to S4 RNeXML into valid NeXML
`o` isn't true.

Validation failed, error messages: 
                    tree 'tree1' has reticulations            Validation failed, error messages: 
                    tree 'tree1' has reticulations (line 15)

test_serializing.R:29: failure: We can serialize parsed NeXML to S4 RNeXML into valid NeXML
`o` isn't true.
hlapp commented 5 years ago

This is in all likelihood because of #169. At least the part unrelated to ape.