Skip to content

Cabalize testing#3

Closed
gregwebs wants to merge 1 commit intoyesodweb:masterfrom
gregwebs:cabal_test
Closed

Cabalize testing#3
gregwebs wants to merge 1 commit intoyesodweb:masterfrom
gregwebs:cabal_test

Conversation

@gregwebs
Copy link
Member

I just downloaded onto a different machine (that I haven't used in months) and got the same problem. Here I put the tests into a cabal file and a cabal build gives me the same as before:

runtests.hs:42:0:
    `sqlType' is not a (visible) method of class `Database.Persist.Base.PersistField'

runtests.hs:42:0:
    `toPersistValue' is not a (visible) method of class `Database.Persist.Base.PersistField'

runtests.hs:42:0:
    `fromPersistValue' is not a (visible) method of class `Database.Persist.Base.PersistField'

@snoyberg
Copy link
Member

It's not going to work when using the installed copies of persistent-(sqlite, postgresql) because the installed copies will be referring to the installed copy of persistent, which has different types (with identical names) to the files in the current directory. You either have to link in the files like I've been saying to try, or use hs-source-dirs like the code below.

In other words, if you ever need to install the backends in order to run the test, you're doing something wrong.

executable         runtests
    if flag(test)
        Buildable: True
    else
        Buildable: False
    hs-source-dirs: ., backends/sqlite, backends/postgresql
    main-is:       runtests.hs
    ghc-options:   -Wall
    build-depends:   HUnit,
                     test-framework,
                     test-framework-hunit,
                     base >= 4 && < 5,
                     template-haskell >= 2.4 && < 2.6,
                     bytestring >= 0.9.1 && < 0.10,
                     transformers >= 0.2.1 && < 0.3,
                     time >= 1.1.4 && < 1.3,
                     text >= 0.7.1 && < 0.12,
                     hamlet >= 0.5 && < 0.7,
                     web-routes-quasi >= 0.6.0 && < 0.7,
                     containers >= 0.2 && < 0.5,
                     parsec >= 2.1 && < 4,
                     enumerator >= 0.4 && < 0.5,
                     stm >= 2.1 && < 2.3,
                     neither >= 0.1 && < 0.2,
                     HDBC-postgresql,
                     HDBC,
                     utf8-string
    extra-libraries: sqlite3

MaxGabriel pushed a commit that referenced this pull request Mar 8, 2018
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants