IreneKnapp / direct-sqlite

MIT License
35 stars 54 forks source link

Test suite depends on specific directory structure, doesn't always exist #60

Closed snoyberg closed 6 years ago

snoyberg commented 8 years ago

Steps to reproduce:

  1. stack unpack direct-sqlite
  2. cd direct-sqlite-*
  3. stack init
  4. stack test

Output:

Creating dist/test/direct-sqlite-test-database.db
test: SQLite3 returned ErrorCan'tOpen while attempting to perform open "dist/test/direct-sqlite-test-database.db": unable to open database file

Completed 2 action(s).
Test suite failure for package direct-sqlite-2.3.16
    test:  exited with: ExitFailure 1
Logs printed to console

This is not a Stack-specific issue, it was originally discovered via the Stackage build process, which calls out to the Setup.hs file directly.

nurpax commented 8 years ago

Thanks for the bug report @snoyberg, I'll take a look!

nurpax commented 8 years ago

@snoyberg Do you have any recommendation on what to use instead of "dist/test"?

I looked at the module Paths_pkgname but that doesn't specify any sort of a temp directory like the build directory that could be used here.

As the test creates the temp db file and deletes it after the test has run (even under exceptions) , I wonder if it'd be ok to just use "./" instead of "./dist/test"? Or maybe use System.IO.Temp.withTempDirectory?

snoyberg commented 8 years ago

I would definitely recommend withTempDirectory

On Tue, Jan 26, 2016, 9:36 PM Janne Hellsten notifications@github.com wrote:

@snoyberg https://github.com/snoyberg Do you have any recommendation on what to use instead of "dist/test"?

I looked at the module Paths_pkgname but that doesn't specify any sort of a temp directory like the build directory that could be used here.

As the test creates the temp db file and deletes it after the test has run (even under exceptions) , I wonder if it'd be ok to just use "./" instead of "./dist/test"? Or maybe use System.IO.Temp.withTempDirectory?

— Reply to this email directly or view it on GitHub https://github.com/IreneKnapp/direct-sqlite/issues/60#issuecomment-175193472 .

nurpax commented 8 years ago

@snoyberg direct-sqlite-2.3.17 should fix this.