[Bioc-devel] Spurious errors unit testing on R CMD check

Hector Corrada Bravo hcorrada at gmail.com
Fri Apr 29 21:06:36 CEST 2016


I've seen this type of error for a while and have really struggled to track
it down. I have a package with unit tests that sporadically fail on R CMD
check with errors of this type:

---
> test_check("epivizrData")
1. Error: new creates a proper object (@test-creation.R#17)
--------------------
attempt to apply non-function
1: expect_equal(mgr$.seqinfo, GenomeInfoDb::Seqinfo()) at
testthat/test-creation.R:17
2: compare(object, expected, ...)
3: compare.default(object, expected, ...)
4: all.equal(x, y, ...)
5: all.equal.default(x, y, ...)
6: GenomeInfoDb::Seqinfo()
7: .normargGenome(genome, seqnames)
8: rep.int(ugenome, length(seqnames))
9: (function (classes, fdef, mtable)
   {
       methods <- .findInheritedMethods(classes, fdef, mtable)
       if (length(methods) == 1L)
           return(methods[[1L]])
       else if (length(methods) == 0L) {
           cnames <- paste0("\"", vapply(classes, as.character, ""), "\"",
collapse = ", ")
           stop(gettextf("unable to find an inherited method for function
%s for signature %s",
               sQuote(fdef at generic), sQuote(cnames)), domain = NA)
       }
       else stop("Internal error in finding inherited methods; didn't
return a unique method",
           domain = NA)
   })(list("character"), structure(function (x, times)
   standardGeneric("rep.int"), generic = structure("rep.int", package =
"base"), package = "base", group = list(), valueClass = character(0),
signature = c("x",
   "times"), default = structure(function (x, times)
   .Internal(rep.int(x, times)), target = structure("ANY", class =
structure("signature", package = "methods"), .Names = "x", package =
"methods"), defined = structure("ANY", class = structure("signature",
package = "methods"), .Names = "x", package = "methods"), generic =
structure("rep.int", package = "base"), class =
structure("derivedDefaultMethod", package = "methods")), skeleton =
(structure(function (x,
       times)
   .Internal(rep.int(x, times)), target = structure("ANY", class =
structure("signature", package = "methods"), .Names = "x", package =
"methods"), defined = structure("ANY", class = structure("signature",
package = "methods"), .Names = "x", package = "methods"), generic =
structure("rep.int", package = "base"), class =
structure("derivedDefaultMethod", package = "methods")))(x,
       times), class = structure("standardGeneric", package = "methods")),
<environment>)
10: .findInheritedMethods(classes, fdef, mtable)
11: .inheritedArgsExpression(m at target, m at defined, body(m))
12: extends(target[[i]], defined[[i]], fullInfo = TRUE)
13: target[[i]]
14: (function (x)
   x$.self$finalize())(<environment>)
---

I do not define any finalize method on classes defined on my package. This
stems from a finalizer on a class defined in a package imported by my
package (GenomeInfoDb), which I'm guessing is detached from the environment
before this finalize function is called.

Any ideas on how to avoid this error?

Package source here:
https://github.com/bioconductor-mirror/epivizrData

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list