views:

390

answers:

4

Hi,

I am unable to run rake test:functionals with SQLite3, it gives me this error :

rake aborted!
Permission denied - db/test.sqlite

(See full trace by running task with --trace)

My setup is on Windows XP. Tests were working a few weeks ago. Rails 2.3.2, Rake 0.8.7, sqlite3-ruby 1.2.5 gems

I am using Netbeans for development, but even when it's close I cannot run the test from a command prompt.

I also checked that no handles to test.sqlite are open (through the sysinternals task manager).

I checked the permissions, they are ok.

I tried to delete the file and recreate it, or copy to another filename without any luck either.

I tried running the command as soon as my computer is booted.

Any help is appreciated.

Thanks

A: 

If you're running under Cygwin, try running this on your database files:

chmod 777 <your-files>

Cygwin can become confused about what permissions should be applied.

Yes I know these permissions are ridiculous, but so is Cygwin sometimes...

Jason Cohen
No I'm running under Windows. Tried it anyway, and not working.
A: 

I have the exact same issue. Any one have a solution to this yet? SQLite database is not locked, running from command-line, get permission denied.

barik
A: 

Very, very similar behavior on my part: Windows XP, SQLite3, Rails 2.3.4, Rake 0.8.7, Ruby 1.8.6

rake test

works (but I don't believe it's actually running the unit test)

rake test:units

and

rake test:functionals

both fail with a "Permission denied - db/test.sqlite3" With --trace enabled the specific error occurs at ../rails-2.3.4/lib/task/databases.rake:370 at a line that reads "File.delete(dbfile) if File.exist?(dbfile)

So... long story short... I commented it out.

This is NOT a fix, but it was enough of a hack to get the tests to work for me.

GSP
A: 

Just a punt, but have you tried changing the path in config/database.yml to

database: db\test.sqlite3

i.e. a backslash instead of a forwardslash. Or even a full dos style path. Issue could be related to this https://rails.lighthouseapp.com/projects/8994/tickets/4153-dbcreate-cannot-open-database-for-sqlite3-on-windows-with-cygwin

malclocke