[Rubygems-developers] Failing Unit Tests

Mauricio Fernández batsman.geo at yahoo.com
Wed Sep 1 05:02:07 EDT 2004


On Tue, Aug 31, 2004 at 06:23:18PM -0400, Jim Weirich wrote:
> But, I did grab the latest CVS to check out the uberrequire hack.  To my 
> dismay, I discovered that we have a failing unit test...
> 
> Is it just my setup, or are others getting it too?
> 
> == BEGIN UNIT TEST OUTPUT ===================================
> Started
> .............F.................................................................................................
> Finished in 24.735418 seconds.
> 
>   1) Failure:
> test_extract_entry_works(TC_TarReader::TC_TarInput)
>     [./test/test_package.rb:527:in `test_extract_entry_works'
>      ./test/test_package.rb:526:in `open_from_io'
>      ./lib/rubygems/package.rb:507:in `open'
>      ./test/test_package.rb:526:in `test_extract_entry_works']:
> <"abcde"> expected but was
> <nil>.

That was broken in this commit:
http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/rubygems/lib/rubygems/package.rb.diff?r1=1.1&r2=1.2&cvsroot=rubygems
[http://tinyurl.com/6zxby]

Gem::Specification.from_yaml raises an exception because "abcde" is
obviously not a gemspec (the exact message is "YAML data doesn't
evaluate to gem specification").

The failure can be fixed trivially by creating a "real" gemspec in 
TC_TarInput#setup; it is harmless.

BTW, I believe it is a bad idea to have TarInput#load_gemspec rescue
all Gem::Exception errors; this is why the real error wasn't shown in
the failing test in the first place.

Maybe it would be a good idea to use some of CVS' hooks to run the unit
tests automatically when committing: I believe the above assertion must
have been failing for over 2 weeks, since

2004-08-17  Gavin Sinclair  <gsinclair at soyabean.com.au>

	* lib/rubygems/specification.rb:
	  - #test_suite_file and #test_files now work on older gems.
	  - Added Specification.from_yaml for loading YAML gemspecs
	  - #to_ruby doesn't emit 'specification_version'

	* lib/rubygems/gem_commands.rb: Updated test-on-install code to use
	  Specification#test_files instead of #unit_test_suite.

	* lib/rubygems/old_format.rb: Use Specification.from_yaml
	* lib/rubygems/package.rb:    Ditto

-- 
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com



More information about the Rubygems-developers mailing list