Skip to content

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

5 messages · Hector Corrada Bravo, Michael Lawrence

#
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:

---
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
#
I can look into it. I guess it fails sporadically because of the
garbage collector. Activating GC torture might make this easier to
reproduce.

On Fri, Apr 29, 2016 at 12:06 PM, Hector Corrada Bravo
<hcorrada at gmail.com> wrote:
#
I don't think there are any reference classes in GenomeInfoDb. This
must be something weird happening to one of the epivizr reference
classes. It just shows up in that stack trace under GenomeInfoDb
because of the GC. I haven't managed to reproduce it yet though.

Michael
On Fri, Apr 29, 2016 at 12:15 PM, Michael Lawrence <michafla at gene.com> wrote:
#
I've removed all finalizers on these classes for this version and are still
seeing it. I'll try with gctorture on and see if I can track it down. Any
finalizers on GenomicRanges? GNCList or GRanges?

On Fri, Apr 29, 2016 at 3:42 PM, Michael Lawrence <lawrence.michael at gene.com

  
  
#
No, those aren't reference classes. There are some reference classes
in GenomicFeatures (like TxDb) and BSgenome. I don't think they set
explicit finalize methods though.

On Fri, Apr 29, 2016 at 12:58 PM, Hector Corrada Bravo
<hcorrada at gmail.com> wrote: