[BioRuby] Submitted JRuby bug and RubySpec addition for unit test failures under JRuby
Clayton Wheeler
cswh at umich.edu
Fri May 11 21:21:02 EDT 2012
Hi all,
I've noticed that many of the BioRuby unit tests are failing under JRuby, locally and on travis-ci, with NameErrors for 'uninitialized constant' conditions. Many of these tests work when running just a single test script in isolation, but fail when the full suite is run with 'rake test'.
I've identified the root cause of this problem, which appears to be a JRuby bug triggered when an autoload entry is defined, the file which would have been autoloaded is explicitly required, and the autoload entry is defined again. Subsequent attempts to access the target of the autoload entry fail with a NameError.
This is an unusual sequence of events, but BioRuby and its test suites contain many 'horizontal' autoload entries between various parts of the source tree. For instance, bio/sequence/common.rb sets up an autoload for Bio::Locations, which I observed causing a problem with subsequent use of Bio::Locations.
I created a minimized RubySpec illustrating the problem, which succeeds under MRI but fails under JRuby, and submitted it:
https://github.com/rubyspec/rubyspec/pull/136
I also filed JRUBY-6658 (http://jira.codehaus.org/browse/JRUBY-6658) for this. If this bug is accepted and fixed, JRuby versions containing the fix should do much better on the test suite.
Without a JRuby fix, it might be possible to work around this by restructuring autoloading in the BioRuby code base to avoid horizontal autoload invocations (that is, autoload declarations not in the parent of the module to be autoloaded), but that could be too invasive to justify.
Clayton Wheeler
cswh at umich.edu
More information about the BioRuby
mailing list