Update test deps.
This commit is contained in:
parent
c642b71b99
commit
24bad8ba0b
@ -84,13 +84,14 @@ test-suite test
|
|||||||
build-depends:
|
build-depends:
|
||||||
-- Library dependencies used on the tests. No need to
|
-- Library dependencies used on the tests. No need to
|
||||||
-- specify versions since they'll use the same as above.
|
-- specify versions since they'll use the same as above.
|
||||||
base, persistent, transformers, conduit, text
|
base, persistent, transformers, resourcet, text
|
||||||
|
|
||||||
-- Test-only dependencies
|
-- Test-only dependencies
|
||||||
|
, conduit >= 1.1
|
||||||
, containers
|
, containers
|
||||||
, HUnit
|
, HUnit
|
||||||
, QuickCheck
|
, QuickCheck
|
||||||
, hspec >= 1.3 && < 1.9
|
, hspec >= 1.9
|
||||||
, persistent-sqlite >= 1.2 && < 1.4
|
, persistent-sqlite >= 1.2 && < 1.4
|
||||||
, persistent-template >= 1.2 && < 1.4
|
, persistent-template >= 1.2 && < 1.4
|
||||||
, monad-control
|
, monad-control
|
||||||
|
|||||||
12
test/Test.hs
12
test/Test.hs
@ -35,7 +35,7 @@ import Database.Persist.Sqlite (withSqliteConn)
|
|||||||
import Database.Persist.TH
|
import Database.Persist.TH
|
||||||
import Test.Hspec
|
import Test.Hspec
|
||||||
|
|
||||||
import qualified Data.Conduit as C
|
import qualified Control.Monad.Trans.Resource as R
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ insert' v = flip Entity v <$> insert v
|
|||||||
|
|
||||||
|
|
||||||
type RunDbMonad m = ( MonadBaseControl IO m, MonadIO m, MonadLogger m
|
type RunDbMonad m = ( MonadBaseControl IO m, MonadIO m, MonadLogger m
|
||||||
, C.MonadUnsafeIO m, C.MonadThrow m )
|
, R.MonadThrow m )
|
||||||
|
|
||||||
#if defined (WITH_POSTGRESQL) || defined (WITH_MYSQL)
|
#if defined (WITH_POSTGRESQL) || defined (WITH_MYSQL)
|
||||||
-- With SQLite and in-memory databases, a separate connection implies a
|
-- With SQLite and in-memory databases, a separate connection implies a
|
||||||
@ -817,7 +817,7 @@ type RunDbMonad m = ( MonadBaseControl IO m, MonadIO m, MonadLogger m
|
|||||||
-- TODO: there is certainly a better way...
|
-- TODO: there is certainly a better way...
|
||||||
cleanDB
|
cleanDB
|
||||||
:: (forall m. RunDbMonad m
|
:: (forall m. RunDbMonad m
|
||||||
=> SqlPersistT (C.ResourceT m) ())
|
=> SqlPersistT (R.ResourceT m) ())
|
||||||
cleanDB = do
|
cleanDB = do
|
||||||
delete $ from $ \(blogpost :: SqlExpr (Entity BlogPost))-> return ()
|
delete $ from $ \(blogpost :: SqlExpr (Entity BlogPost))-> return ()
|
||||||
delete $ from $ \(follow :: SqlExpr (Entity Follow)) -> return ()
|
delete $ from $ \(follow :: SqlExpr (Entity Follow)) -> return ()
|
||||||
@ -825,7 +825,7 @@ cleanDB = do
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
run, runSilent, runVerbose :: (forall m. RunDbMonad m => SqlPersistT (C.ResourceT m) a) -> IO a
|
run, runSilent, runVerbose :: (forall m. RunDbMonad m => SqlPersistT (R.ResourceT m) a) -> IO a
|
||||||
runSilent act = runNoLoggingT $ run_worker act
|
runSilent act = runNoLoggingT $ run_worker act
|
||||||
runVerbose act = runStderrLoggingT $ run_worker act
|
runVerbose act = runStderrLoggingT $ run_worker act
|
||||||
run =
|
run =
|
||||||
@ -838,9 +838,9 @@ verbose :: Bool
|
|||||||
verbose = True
|
verbose = True
|
||||||
|
|
||||||
|
|
||||||
run_worker :: RunDbMonad m => SqlPersistT (C.ResourceT m) a -> m a
|
run_worker :: RunDbMonad m => SqlPersistT (R.ResourceT m) a -> m a
|
||||||
run_worker act =
|
run_worker act =
|
||||||
C.runResourceT .
|
R.runResourceT .
|
||||||
#if defined(WITH_POSTGRESQL)
|
#if defined(WITH_POSTGRESQL)
|
||||||
withPostgresqlConn "host=localhost port=5432 user=test dbname=test" .
|
withPostgresqlConn "host=localhost port=5432 user=test dbname=test" .
|
||||||
#elif defined (WITH_MYSQL)
|
#elif defined (WITH_MYSQL)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user