Is there any way to ask a file what other file require/load 'd it? I
imagine this has been asked before but I couldnt seem to find good
terms to search for it.
The reason I ask is b/c I am getting the freakiest error. I’m running
my test, right. Now when I run them one at a time by hand they all
work fine. But if I run them via a script that in turn runs them one
at time for me, eg:
test_files.each do |file|
sh %{ruby -e ‘puts “\n\n#{file}”; load “#{file}”’ >> #{output}}
end
Then I get a very very very strange error where, test_autoarray.rb
seems to somehow cause text_infinity.rb to load even though they have
no connection whatsoever, but worse, it’s not the test_infinity.rb
that is supposed to load about 70 test files later, but rather the
test file in my pkg/ staging folder! I have no idea how it picks that
up. The one thing that strikes me is that the pkg/ file it hard linked
to the real file, but I don’t see how Ruby could possibly know that.
Below is a snip of the output. I added a ‘p FILE’ and a ‘p caller’
to the top of test_infinity.rb to show the file it’s coming from. As
you can see it’s running right along fine but when it hits
test_autoarray.rb that’s when it goes wack. But then it goes right
back to normal and finishes without issue.
T.
…
test/unit/hash/test_at.rb
Loaded suite -e
Started
.
Finished in 0.001158 seconds.
1 tests, 2 assertions, 0 failures, 0 errors
test/unit/test_attributes.rb
Loaded suite -e
Started
…
Finished in 0.001688 seconds.
2 tests, 2 assertions, 0 failures, 0 errors
test/unit/test_autoarray.rb
“./pkg/facets-2.0.2/test/unit/test_infinity.rb”
["./pkg/facets-2.0.2/test/unit/test_infinity.rb:15:in require'", "./ pkg/facets-2.0.2/test/unit/test_infinity.rb:15", "/usr/lib/ruby/1.8/ test/unit/collector/dir.rb:90:in
require’", “/usr/lib/ruby/1.8/test/
unit/collector/dir.rb:90:in collect_file'", "/usr/lib/ruby/1.8/test/ unit/collector/dir.rb:73:in
recursive_collect’”, “/usr/lib/ruby/1.8/
test/unit/collector/dir.rb:58:in each'", "/usr/lib/ruby/1.8/test/unit/ collector/dir.rb:58:in
recursive_collect’”, “/usr/lib/ruby/1.8/test/
unit/collector/dir.rb:63:in recursive_collect'", "/usr/lib/ruby/1.8/ test/unit/collector/dir.rb:58:in
each’”, “/usr/lib/ruby/1.8/test/unit/
collector/dir.rb:58:in recursive_collect'", "/usr/lib/ruby/1.8/test/ unit/collector/dir.rb:63:in
recursive_collect’”, “/usr/lib/ruby/1.8/
test/unit/collector/dir.rb:58:in each'", "/usr/lib/ruby/1.8/test/unit/ collector/dir.rb:58:in
recursive_collect’”, “/usr/lib/ruby/1.8/test/
unit/collector/dir.rb:63:in recursive_collect'", "/usr/lib/ruby/1.8/ test/unit/collector/dir.rb:58:in
each’”, “/usr/lib/ruby/1.8/test/unit/
collector/dir.rb:58:in recursive_collect'", "/usr/lib/ruby/1.8/test/ unit/collector/dir.rb:63:in
recursive_collect’”, “/usr/lib/ruby/1.8/
test/unit/collector/dir.rb:58:in each'", "/usr/lib/ruby/1.8/test/unit/ collector/dir.rb:58:in
recursive_collect’”, “/usr/lib/ruby/1.8/test/
unit/collector/dir.rb:29:in collect'", "/usr/lib/ruby/1.8/test/unit/ autorunner.rb:68", "/usr/lib/ruby/1.8/test/unit/autorunner.rb:213:in
[]’”, “/usr/lib/ruby/1.8/test/unit/autorunner.rb:213:in run'", "/usr/ lib/ruby/1.8/test/unit/autorunner.rb:12:in
run’”, “/usr/lib/ruby/1.8/
test/unit.rb:278”, “-e:3”]
test/unit/test_basicobject.rb
Loaded suite -e
Started
…
Finished in 0.004726 seconds.
7 tests, 13 assertions, 0 failures, 0 errors
… and so on w/o issue …