[flake] hspec/Main.hs fixes, but still coverage report doesn't work

parent 9fdb30c5
...@@ -697,7 +697,7 @@ ...@@ -697,7 +697,7 @@
# cabal.project.flake must be in the same directory than the original cabal.project # cabal.project.flake must be in the same directory than the original cabal.project
# for the relative paths in the packages stanza to point to the correct subdirs. # for the relative paths in the packages stanza to point to the correct subdirs.
shellHook = '' shellHook = ''
export GARGANTEXT_START_CORENLP="nix run .#coreNLP" export GARGANTEXT_CORENLP_SERVER="nix run .#coreNLP"
ln -sf ${pkgs.runCommandLocal "cabal.project" { ln -sf ${pkgs.runCommandLocal "cabal.project" {
nativeBuildInputs = with pkgs; [ gawk ]; nativeBuildInputs = with pkgs; [ gawk ];
} }
......
...@@ -8,6 +8,7 @@ import Control.Monad ...@@ -8,6 +8,7 @@ import Control.Monad
import Data.Text (isInfixOf) import Data.Text (isInfixOf)
import Shelly hiding (FilePath) import Shelly hiding (FilePath)
import System.IO import System.IO
import System.Environment (lookupEnv)
import System.Process import System.Process
import Test.Hspec import Test.Hspec
import qualified Data.Text as T import qualified Data.Text as T
...@@ -21,12 +22,14 @@ startCoreNLPServer = do ...@@ -21,12 +22,14 @@ startCoreNLPServer = do
-- Make the CoreNLP server configurable by an envvar, eg. set by nix develop -- Make the CoreNLP server configurable by an envvar, eg. set by nix develop
startServer <- lookupEnv "GARGANTEXT_CORENLP_SERVER" startServer <- lookupEnv "GARGANTEXT_CORENLP_SERVER"
let p = proc (fromMaybe "./startServer.sh" <$> startServer) [] let p = proc (fromMaybe "./startServer.sh" <$> startServer) []
(_, _, _, hdl) <- (createProcess $ p { cwd = maybe (Just "devops/coreNLP/stanford-corenlp-current") Nothing startServer -- let cwd = fromMaybe "/devops/coreNLP/stanford-corenlp-current" startServer
, delegate_ctlc = True let cwd = Nothing
, create_group = True (_, _, _, hdl) <- (createProcess $ p { cwd = cwd
, std_out = UseHandle devNull , delegate_ctlc = True
, std_err = UseHandle devNull , create_group = True
}) `catch` \e -> case e of , std_out = UseHandle devNull
, std_err = UseHandle devNull
}) `catch` \e -> case e of
_ | True <- "does not exist" `isInfixOf` (T.pack . show @SomeException $ e) _ | True <- "does not exist" `isInfixOf` (T.pack . show @SomeException $ e)
-> fail $ "Cannot execute the 'startServer.sh' script. If this is the " <> -> fail $ "Cannot execute the 'startServer.sh' script. If this is the " <>
"first time you are running the tests, you have to run " <> "first time you are running the tests, you have to run " <>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment