Closed solnic closed 11 years ago
thanks for report, we'll look into that. ;)
I have no idea how to reproduce this issue, but I modified fake creation so that copied_class is no longer set using an accessor, so this error should no longer happen. If you could check if Bogus @ e6e323a3dfe38cccd0598a765c108d4590c1d2ab and Mutant @ f3a2e42f70c5 work, I'd be very grateful.
Now I'm getting this:
/home/vagrant/.gem/ruby/1.9.3/bundler/gems/bogus-6ee7e34ea84c/lib/bogus/fake.rb:37:in `name': undefined local variable or method `__copied_class__' for #<Class:0x000000025d61d0> (NameError)
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:64:in `emit_scope'
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:51:in `block in scopes'
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:50:in `each_object'
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:50:in `each'
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:50:in `scopes'
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:21:in `each'
from /home/vagrant/mutant/lib/mutant/matcher/namespace.rb:21:in `each'
from /home/vagrant/mutant/lib/mutant/cli/classifier.rb:99:in `each'
from /home/vagrant/mutant/lib/mutant/config.rb:22:in `subjects'
from /home/vagrant/mutant/lib/mutant/runner.rb:153:in `each'
from /home/vagrant/mutant/lib/mutant/runner.rb:153:in `dispatch'
from /home/vagrant/mutant/lib/mutant/runner/config.rb:77:in `run_subjects'
from /home/vagrant/mutant/lib/mutant/runner/config.rb:89:in `run'
from /home/vagrant/mutant/lib/mutant/runner.rb:73:in `initialize'
from /home/vagrant/.gem/ruby/1.9.3/gems/abstract_type-0.0.6/lib/abstract_type.rb:38:in `new'
from /home/vagrant/.gem/ruby/1.9.3/gems/abstract_type-0.0.6/lib/abstract_type.rb:38:in `new'
from /home/vagrant/.gem/ruby/1.9.3/gems/adamantium-0.0.10/lib/adamantium/class_methods.rb:17:in `new'
from /home/vagrant/mutant/lib/mutant/runner/config.rb:19:in `run'
from /home/vagrant/mutant/lib/mutant/cli.rb:26:in `run'
from /home/vagrant/mutant/bin/mutant:18:in `<top (required)>'
from /home/vagrant/.gem/ruby/1.9.3/bin/mutant:19:in `load'
from /home/vagrant/.gem/ruby/1.9.3/bin/mutant:19:in `<main>'
from /home/vagrant/.gem/ruby/1.9.3/bin/ruby_noexec_wrapper:14:in `eval'
from /home/vagrant/.gem/ruby/1.9.3/bin/ruby_noexec_wrapper:14:in `<main>'
o_O
This is seriously weird. The only way that could happen is if we are creating an instance of Fake class, which we never do. Every time we actually use it, we define a subclass with __copied_class__
already defined.
We really need to get our hands on some reproducible example here.
@psyho ok do this:
git clone https://github.com/rom-rb/rom-mapper.git
cd rom-mapper
git co -b no-bogus-workaround --track origin/no-bogus-workaround
bundle install
bundle exec mutant 'ROM::Mapper*' --rspec-unit
it will run fine for some time and crash eventually
I forgot that the Fake class would also show up in the object space. D'oh!
@psyho @wrozka thanks guys, I can confirm this indeed fixed the problem, have you released the patched version already?
It's hard for me to figure it out but it seems like mutant tries to mutate a class that was copied by bogus' fake but in the moment it's happening that fake is not fully setup.
I have no idea how to solve this :/ Maybe it's mutant kicking in too early, maybe it's bogus being in a weird broken state? Please HALP ;)