Skip to content

Commit

Permalink
Merge pull request #9454 from mpickering/wip/t9453
Browse files Browse the repository at this point in the history
testsuite: Introduce Cabal-tests library for common testsuite functions
  • Loading branch information
mergify[bot] authored Nov 29, 2023
2 parents cf8fdb0 + 624fb7b commit 39d42e6
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Cabal-tests/Cabal-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ source-repository head
location: https://github.com/haskell/cabal/
subdir: Cabal-tests

-- Common utilities which can be used by all tests.
library
hs-source-dirs: lib
exposed-modules: Test.Utils.TempTestDir
build-depends: base, directory, Cabal

-- Small, fast running tests.
test-suite unit-tests
type: exitcode-stdio-1.0
Expand Down Expand Up @@ -58,6 +64,7 @@ test-suite unit-tests
, Cabal-described
, Cabal-syntax
, Cabal-QuickCheck
, Cabal-tests
, containers
, deepseq
, Diff >=0.4 && <0.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP #-}

module Distribution.Utils.TempTestDir
module Test.Utils.TempTestDir
( withTestDir
, removeDirectoryRecursiveHack
) where
Expand Down
1 change: 0 additions & 1 deletion Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ library
Distribution.Utils.Json
Distribution.Utils.NubList
Distribution.Utils.Progress
Distribution.Utils.TempTestDir
Distribution.Verbosity
Distribution.Verbosity.Internal

Expand Down
2 changes: 2 additions & 0 deletions cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ test-suite unit-tests
cabal-install,
Cabal-tree-diff,
Cabal-QuickCheck,
Cabal-tests,
containers,
directory,
filepath,
Expand Down Expand Up @@ -409,6 +410,7 @@ test-suite long-tests
build-depends:
Cabal-QuickCheck,
Cabal-described,
Cabal-tests,
cabal-install,
containers,
directory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import Distribution.Client.Types.Repo (Repo (..), emptyRemoteRepo)
import Distribution.Client.Types.RepoName (RepoName (..))
import Distribution.Types.PackageId (PackageIdentifier (..))
import Distribution.Types.PackageName (mkPackageName)
import Distribution.Utils.TempTestDir (withTestDir)
import qualified Distribution.Verbosity as Verbosity
import Distribution.Version (mkVersion)
import Network.URI (URI, uriPath)
import Test.Tasty
import Test.Tasty.HUnit
import Test.Utils.TempTestDir (withTestDir)

tests :: [TestTree]
tests =
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/tests/UnitTests/Distribution/Client/Get.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import System.Exit
import System.FilePath
import System.IO.Error

import Distribution.Utils.TempTestDir (withTestDir)
import Test.Tasty
import Test.Tasty.HUnit
import Test.Utils.TempTestDir (withTestDir)
import UnitTests.Options (RunNetworkTests (..))

tests :: [TestTree]
Expand Down
2 changes: 1 addition & 1 deletion cabal-install/tests/UnitTests/Distribution/Client/VCS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import Distribution.Client.Types.SourceRepo (SourceRepoProxy, SourceRepositoryPa
import Distribution.Client.VCS
import Distribution.Simple.Program
import Distribution.System (OS (Windows), buildOS)
import Distribution.Utils.TempTestDir (removeDirectoryRecursiveHack, withTestDir)
import Distribution.Verbosity as Verbosity
import Test.Utils.TempTestDir (removeDirectoryRecursiveHack, withTestDir)

import Data.List (mapAccumL)
import qualified Data.Map as Map
Expand Down
1 change: 1 addition & 0 deletions cabal-testsuite/cabal-testsuite.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ common shared
-- this needs to match the in-tree lib:Cabal version
, Cabal ^>= 3.11.0.0
, Cabal-syntax ^>= 3.11.0.0
, Cabal-tests

ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns

Expand Down
2 changes: 1 addition & 1 deletion cabal-testsuite/src/Test/Cabal/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import Distribution.Simple.Configure
import qualified Distribution.Simple.Utils as U (cabalVersion)
import Distribution.Text

import Distribution.Utils.TempTestDir (removeDirectoryRecursiveHack)
import Test.Utils.TempTestDir (removeDirectoryRecursiveHack)
import Distribution.Verbosity
import Distribution.Version

Expand Down
2 changes: 1 addition & 1 deletion cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Distribution.Parsec (eitherParsec)
import Distribution.Types.UnqualComponentName
import Distribution.Types.LocalBuildInfo
import Distribution.PackageDescription
import Distribution.Utils.TempTestDir (withTestDir)
import Test.Utils.TempTestDir (withTestDir)
import Distribution.Verbosity (normal)

import Distribution.Compat.Stack
Expand Down
12 changes: 12 additions & 0 deletions changelog.d/issue-9453
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
synopsis: Remove Distribution.Utils.TempTestDir module from Cabal library
packages: Cabal
prs: #9454
issues: #9453

description: {

This library was only used by internal tests, and now lives in the `Cabal-tests` library
which is shared across test components.

}

0 comments on commit 39d42e6

Please sign in to comment.