Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: module ‘main:Bar’ is defined in multiple files #16

Open
kindaro opened this issue Jan 22, 2018 · 3 comments
Open

error: module ‘main:Bar’ is defined in multiple files #16

kindaro opened this issue Jan 22, 2018 · 3 comments

Comments

@kindaro
Copy link
Contributor

kindaro commented Jan 22, 2018

What I do: I have a few doctests in the module Symbolic.hs of the project symbolic. It's nothing special. doctest runs manually from command line without any sign of misbehaviour, correctly performs the tests specified in the module. I try to set up doctest-discover to run tests with stack.

My expectations: When set up in package.yaml as recommended, doctest will be run by stack test successfully.

What happens: Everything builds alright. As the process enters the testing stage, an error occurs:

symbolic-0.1.0.0: test (suite: doctest)
             
Progress: 3/4
<no location info>: error:
    module ‘main:Bar’ is defined in multiple files: /home/kindaro/code/symbolic/.stack-work/downloaded/wTjnDRat1Snx/doctest-master/test/extract/imported-module/Bar.hs
                                                    /home/kindaro/code/symbolic/.stack-work/downloaded/wTjnDRat1Snx/doctest-master/test/extract/th/Bar.hs
                                                    /home/kindaro/code/symbolic/.stack-work/downloaded/wTjnDRat1Snx/doctest-master/test/integration/with-cbits/Bar.hs
                                                    /home/kindaro/code/symbolic/.stack-work/downloaded/wTjnDRat1Snx/doctest-master/test/integration/custom-package-conf/Bar.hs                                                  
Completed 4 action(s).
Test suite failure for package symbolic-0.1.0.0
    doctest:  exited with: ExitFailure 1

I don't know what to do. These files in .stack-work apparently belong to doctest, not doctest-discover, but, as I said, I can run doctest from command line without any issues. I am reporting this here because I have no better idea.

These are the relevant code extracts:

doctest-config.json

{
    "sourceFolders": ["."], 
    "ignore": ["src"]
}

doctest-driver.hs

{-# OPTIONS_GHC -F -pgmF doctest-discover -optF doctest-config.json #-}

package.yaml

name: symbolic
version: 0.1.0.0
license: ISC

ghc-options: -Wall

dependencies:
  - base >= 4.8 && < 5
  - transformers
  - mtl
  - text

library:
  source-dirs: .

tests:
    doctest:
        main: doctest-driver.hs
        dependencies:
            - base >4 && <5
            - doctest
            - doctest-discover
        source-dirs: .

I will appreciate any advice.

@karun012
Copy link
Owner

Are you using a local copy of doctest-discover?

@kindaro
Copy link
Contributor Author

kindaro commented Jan 23, 2018

@karun012 Yes, I cloned this repo and stack installed from there. This was the wrong thing to do. I just stack installed whatever version comes from Stackage and it works flawlessly.

@karun012
Copy link
Owner

Awesome. I'll leave this issue open. I'd like to make sure it works even if you use a local copy.

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

No branches or pull requests

2 participants