I am getting this weird EOFError when running tests using rake When running unit tests one by one (test file by test file), this error does not pop up. Does anyone know what is happening? Thanks! -- Posted via http://www.ruby-forum.com/.
Oh I forget to mention, obviously some tests include CRUD operations on the object that has been indexed in addition to using fixtures, I also have written some test helper methods (add_post() for example) Thanks. Miguel wrote:> I am getting this weird EOFError when running tests using rake > > When running unit tests one by one (test file by test file), this error > does not pop up. Does anyone know what is happening? > > Thanks!-- Posted via http://www.ruby-forum.com/.
On 9/22/06, Miguel <miguel.wong at gmail.com> wrote:> Oh I forget to mention, obviously some tests include CRUD operations on > the object that has been indexed > > in addition to using fixtures, I also have written some test helper > methods (add_post() for example) > > Thanks. > > Miguel wrote: > > I am getting this weird EOFError when running tests using rake > > > > When running unit tests one by one (test file by test file), this error > > does not pop up. Does anyone know what is happening? > > > > Thanks! >Hi Miguel, A couple of questions will help us answer this. Are you on Windows? Is your application a Rails app? Are you using acts_as_ferret? The first thing I''d check is that you are closing your Index, IndexReader or IndexWriter when you are finished with it (ie in your test methods . Not doing this can possibly cause and EOFError. Also, on Windows, I had a lot of trouble making sure files get deleted correctly, but I may have made a mistake somewhere. I hope we can help you out, Dave
Hello Dave, Thanks for your reply. I am indeed using acts_as_ferret on ferret 0.9.6 on Windows. When i manually delete the test index, it sometimes work. But only sometimes. I do not see a pattern. Please help! Thanks in advance! Miguel p.s. I will also try the closing the index trick. If that work, i will report here for documentation purposes. thanks. David Balmain wrote:> On 9/22/06, Miguel <miguel.wong at gmail.com> wrote: >> > >> > When running unit tests one by one (test file by test file), this error >> > does not pop up. Does anyone know what is happening? >> > >> > Thanks! >> > > Hi Miguel, > > A couple of questions will help us answer this. Are you on Windows? Is > your application a Rails app? Are you using acts_as_ferret? > > The first thing I''d check is that you are closing your Index, > IndexReader or IndexWriter when you are finished with it (ie in your > test methods . Not doing this can possibly cause and EOFError. Also, > on Windows, I had a lot of trouble making sure files get deleted > correctly, but I may have made a mistake somewhere. > > I hope we can help you out, > Dave-- Posted via http://www.ruby-forum.com/.
On 10/11/06, MIguel <miguel.wong at gmail.com> wrote:> Hello Dave, > > Thanks for your reply. I am indeed using acts_as_ferret on ferret 0.9.6 > on Windows. When i manually delete the test index, it sometimes work. > But only sometimes. I do not see a pattern. Please help! Thanks in > advance! > > Miguel > > p.s. I will also try the closing the index trick. If that work, i will > report here for documentation purposes. thanks.I''d say your error is almost certainly caused by the fact that you have left an IndexWriter or Index open somewhere. By the way, why are you still using 0.9.6? It is definitely worth upgrading as you''d be using the much slower pure ruby version on Windows. Cheers, Dave
Hi David, I tried calling index.close at the teardown method. But since i am using acts_as_ferret, it looks like AAF closes the index after it''s done updating it, so i am getting errors of "closing an already closed index" - am i doing anything wrong? Or should i just switch over the linux :-) I tried upgrading to 0.10.x, the gems installed OK, but there is this name error for the constant FIELD when i load up script/console. Thanks again for your answers!! Miguel David Balmain wrote:> On 10/11/06, MIguel <miguel.wong at gmail.com> wrote: >> report here for documentation purposes. thanks. > I''d say your error is almost certainly caused by the fact that you > have left an IndexWriter or Index open somewhere. By the way, why are > you still using 0.9.6? It is definitely worth upgrading as you''d be > using the much slower pure ruby version on Windows. > > Cheers, > Dave-- Posted via http://www.ruby-forum.com/.
On 10/11/06, MIguel <miguel.wong at gmail.com> wrote:> Hi David, > > I tried calling index.close at the teardown method. But since i am > using acts_as_ferret, it looks like AAF closes the index after it''s done > updating it, so i am getting errors of "closing an already closed index" > - am i doing anything wrong? Or should i just switch over the linux :-) > > I tried upgrading to 0.10.x, the gems installed OK, but there is this > name error for the constant FIELD when i load up script/console. > > Thanks again for your answers!! > > Miguel >The API changed between 0.9 and 0.10 so you''ll have to make some changes. Check the tutorial at http://ferret.davebalmain.com/api, in particular the section on adding Documents. Hopefully that will help you fix the problem. Cheers, Dave