Skip to content

Commit 66fae14

Browse files
authored
Merge pull request #466 from haskell-distributed/tasty-port
Port test suites to `tasty` (from `test-framework`)
2 parents 477d17c + 043c82d commit 66fae14

File tree

45 files changed

+183
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+183
-289
lines changed

packages/distributed-process-async/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Unreleased
2+
3+
* Ported test suite to use `tasty` rather than `test-framework`.
4+
15
2024-10-30 David Simmons-Duffin <[email protected]> 0.2.10
26

37
* Bump dependency bound for ansi-terminal

packages/distributed-process-async/distributed-process-async.cabal

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ common warnings
3232
-Wredundant-constraints
3333
-fhide-source-paths
3434
-Wpartial-fields
35+
-Wunused-packages
3536

3637
library
3738
import: warnings
@@ -75,13 +76,11 @@ test-suite AsyncTests
7576
network-transport-tcp >= 0.6 && < 0.9,
7677
binary >= 0.8 && < 0.9,
7778
deepseq >= 1.4 && < 1.7,
78-
-- HUnit >= 1.2 && < 2,
7979
stm >= 2.3 && < 2.6,
80-
test-framework >= 0.6 && < 0.9,
81-
test-framework-hunit,
80+
tasty >= 1.5 && <1.6,
81+
tasty-hunit >=0.10 && <0.11,
8282
transformers
83-
hs-source-dirs:
84-
tests
83+
hs-source-dirs: tests
8584
default-language: Haskell2010
8685
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
8786
default-extensions: CPP

packages/distributed-process-async/tests/TestAsync.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import Data.Typeable()
1717
import Network.Transport.TCP
1818
import qualified Network.Transport as NT
1919

20-
import Test.Framework (Test, testGroup, defaultMain)
21-
import Test.Framework.Providers.HUnit (testCase)
20+
import Test.Tasty(TestTree, testGroup, defaultMain)
21+
import Test.Tasty.HUnit (testCase)
2222

2323
testAsyncPoll :: TestResult (AsyncResult ()) -> Process ()
2424
testAsyncPoll result = do
@@ -158,8 +158,8 @@ testAsyncRecursive result = do
158158
myNode <- getSelfNode
159159
fib (myNode,6) >>= stash result
160160

161-
tests :: LocalNode -> [Test]
162-
tests localNode = [
161+
tests :: LocalNode -> TestTree
162+
tests localNode = testGroup "" [
163163
testGroup "Handling async results with STM" [
164164
testCase "testAsyncCancel"
165165
(delayedAssertion
@@ -210,14 +210,14 @@ tests localNode = [
210210
]
211211
]
212212

213-
asyncStmTests :: NT.Transport -> IO [Test]
213+
asyncStmTests :: NT.Transport -> IO TestTree
214214
asyncStmTests transport = do
215215
localNode <- newLocalNode transport $ __remoteTableDecl initRemoteTable
216216
let testData = tests localNode
217217
return testData
218218

219219
-- | Given a @builder@ function, make and run a test suite on a single transport
220-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
220+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
221221
testMain builder = do
222222
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
223223
testData <- builder transport

packages/distributed-process-client-server/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
Unreleased
4+
5+
* Ported test suite to use `tasty` rather than `test-framework`.
6+
37
2024-10-30 David Simmons-Duffin <[email protected]> 0.2.7.1
48

59
* Bump dependency bound for ansi-terminal

packages/distributed-process-client-server/distributed-process-client-server.cabal

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ common warnings
3333
-Wredundant-constraints
3434
-fhide-source-paths
3535
-Wpartial-fields
36+
-Wunused-packages
3637

3738
library
3839
import: warnings
@@ -87,10 +88,9 @@ test-suite ManagedProcessTests
8788
binary >= 0.8 && < 0.9,
8889
deepseq,
8990
network >= 2.3 && < 3.3,
90-
HUnit >= 1.2 && < 2,
9191
stm,
92-
test-framework >= 0.6 && < 0.9,
93-
test-framework-hunit,
92+
tasty >= 1.5 && <1.6,
93+
tasty-hunit >=0.10 && <0.11,
9494
transformers,
9595
ghc-prim,
9696
exceptions
@@ -125,10 +125,9 @@ test-suite PrioritisedProcessTests
125125
binary,
126126
deepseq,
127127
network,
128-
HUnit,
129128
stm,
130-
test-framework,
131-
test-framework-hunit,
129+
tasty >= 1.5 && <1.6,
130+
tasty-hunit >=0.10 && <0.11,
132131
transformers,
133132
ghc-prim,
134133
exceptions

packages/distributed-process-client-server/tests/TestManagedProcess.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import MathsDemo
2626
import Counter
2727
import qualified SafeCounter as SafeCounter
2828

29-
import Test.Framework (Test, testGroup)
30-
import Test.Framework.Providers.HUnit (testCase)
29+
import Test.Tasty (TestTree, testGroup)
30+
import Test.Tasty.HUnit (testCase)
3131
import TestUtils
3232
import ManagedProcessCommon
3333

@@ -210,13 +210,14 @@ testCounterExceedsLimit result = do
210210
]
211211
stash result (r /= DiedNormal)
212212

213-
tests :: NT.Transport -> IO [Test]
213+
tests :: NT.Transport -> IO TestTree
214214
tests transport = do
215215
localNode <- newLocalNode transport initRemoteTable
216216
scpid <- newEmptyMVar
217217
_ <- forkProcess localNode $ SafeCounter.startCounter 5 >>= stash scpid
218218
safeCounter <- takeMVar scpid
219-
return [
219+
return $
220+
testGroup "" [
220221
testGroup "Basic Client/Server Functionality" [
221222
testCase "basic call with explicit server reply"
222223
(delayedAssertion

packages/distributed-process-client-server/tests/TestPrioritisedProcess.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import Data.List (isInfixOf)
3838
import Data.Maybe (isNothing, isJust)
3939
import Data.Typeable (Typeable)
4040

41-
import Test.Framework (Test, testGroup)
42-
import Test.Framework.Providers.HUnit (testCase)
41+
import Test.Tasty (TestTree, testGroup)
42+
import Test.Tasty.HUnit (testCase)
4343
import TestUtils
4444
import ManagedProcessCommon
4545

@@ -534,10 +534,10 @@ testCallPrioritisation result = do
534534
let ms = rights st
535535
stash result $ ms == ["we do prioritise", "the longest", "commands", "first"]
536536

537-
tests :: NT.Transport -> IO [Test]
537+
tests :: NT.Transport -> IO TestTree
538538
tests transport = do
539539
localNode <- newLocalNode transport initRemoteTable
540-
return [
540+
return $ testGroup "" [
541541
testGroup "basic server functionality matches un-prioritised processes" [
542542
testCase "basic call with explicit server reply"
543543
(delayedAssertion

packages/distributed-process-client-server/tests/TestUtils.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Control.Distributed.Process.Node
1818
import Control.Distributed.Process.Extras
1919
import Control.Distributed.Process.Extras.Time
2020
import Control.Distributed.Process.Extras.Timer
21-
import Test.Framework (Test, defaultMain)
21+
import Test.Tasty (TestTree, defaultMain)
2222

2323
import Network.Transport.TCP
2424
import qualified Network.Transport as NT
@@ -41,7 +41,7 @@ mkNode port = do
4141
newLocalNode transport1 initRemoteTable
4242

4343
-- | Given a @builder@ function, make and run a test suite on a single transport
44-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
44+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
4545
testMain builder = do
4646
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "0") defaultTCPParameters
4747
testData <- builder transport

packages/distributed-process-execution/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Unreleased
2+
3+
* Ported test suite to use `tasty` rather than `test-framework`.
4+
15
2024-10-30 David Simmons-Duffin <[email protected]> 0.1.4.1
26

37
* Bump dependency bound for ansi-terminal

packages/distributed-process-execution/distributed-process-execution.cabal

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ common warnings
3333
-Wredundant-constraints
3434
-fhide-source-paths
3535
-Wpartial-fields
36+
-Wunused-packages
3637

3738
library
3839
import: warnings
@@ -45,14 +46,10 @@ library
4546
distributed-process-client-server >= 0.2.0 && < 0.3,
4647
binary >= 0.8 && < 0.9,
4748
deepseq >= 1.4 && < 1.7,
48-
mtl,
4949
containers >= 0.6 && < 0.8,
5050
hashable >= 1.2.0.5 && < 1.6,
5151
unordered-containers >= 0.2.3.0 && < 0.3,
52-
fingertree < 0.2,
5352
stm >= 2.4 && < 2.6,
54-
time,
55-
transformers
5653
hs-source-dirs: src
5754
exposed-modules:
5855
Control.Distributed.Process.Execution,
@@ -69,38 +66,16 @@ library
6966
test-suite ExchangeTests
7067
import: warnings
7168
type: exitcode-stdio-1.0
72-
-- x-uses-tf: true
73-
build-depends:
74-
base >= 4.14 && < 5,
75-
ansi-terminal >= 0.5 && < 1.2,
76-
containers,
77-
hashable,
78-
unordered-containers >= 0.2.3.0 && < 0.3,
69+
build-depends: base >= 4.14 && < 5,
7970
distributed-process,
8071
distributed-process-execution,
8172
distributed-process-extras,
8273
distributed-process-systest ^>= 0.4,
83-
distributed-static,
84-
bytestring,
85-
data-accessor,
86-
fingertree < 0.2,
8774
network-transport >= 0.4 && < 0.6,
88-
deepseq,
89-
mtl,
9075
network-transport-tcp >= 0.4 && < 0.9,
91-
binary >= 0.8 && < 0.9,
92-
network >= 2.3 && < 3.3,
93-
HUnit >= 1.2 && < 2,
94-
stm,
95-
time,
96-
test-framework >= 0.6 && < 0.9,
97-
test-framework-hunit,
98-
QuickCheck >= 2.4,
99-
test-framework-quickcheck2,
100-
transformers,
101-
ghc-prim
102-
hs-source-dirs:
103-
tests
76+
tasty >= 1.5 && <1.6,
77+
tasty-hunit >=0.10 && <0.11,
78+
hs-source-dirs: tests
10479
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
10580
main-is: TestExchange.hs
10681
default-language: Haskell2010
@@ -109,38 +84,16 @@ test-suite ExchangeTests
10984
test-suite MailboxTests
11085
import: warnings
11186
type: exitcode-stdio-1.0
112-
-- x-uses-tf: true
113-
build-depends:
114-
base >= 4.14 && < 5,
115-
ansi-terminal >= 0.5 && < 1.2,
116-
containers,
117-
hashable,
118-
unordered-containers >= 0.2.3.0 && < 0.3,
87+
build-depends: base >= 4.14 && < 5,
11988
distributed-process,
12089
distributed-process-execution,
12190
distributed-process-extras,
12291
distributed-process-systest ^>= 0.4,
123-
distributed-static,
124-
bytestring,
125-
data-accessor,
126-
fingertree < 0.2,
12792
network-transport >= 0.4 && < 0.6,
128-
deepseq,
129-
mtl,
13093
network-transport-tcp >= 0.4 && < 0.9,
131-
binary >= 0.8 && < 0.9,
132-
network >= 2.3 && < 3.3,
133-
HUnit >= 1.2 && < 2,
134-
stm,
135-
time,
136-
test-framework >= 0.6 && < 0.9,
137-
test-framework-hunit,
138-
QuickCheck >= 2.4,
139-
test-framework-quickcheck2,
140-
transformers,
141-
ghc-prim
142-
hs-source-dirs:
143-
tests
94+
tasty >= 1.5 && <1.6,
95+
tasty-hunit >=0.10 && <0.11,
96+
hs-source-dirs: tests
14497
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
14598
main-is: TestMailbox.hs
14699
other-modules: MailboxTestFilters

packages/distributed-process-execution/tests/TestExchange.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import Control.Monad (void, forM, forever)
2222
import Prelude hiding (drop)
2323
import Network.Transport.TCP
2424
import qualified Network.Transport as NT
25-
import Test.Framework as TF (defaultMain, testGroup, Test)
26-
import Test.Framework.Providers.HUnit
27-
import Test.HUnit (assertEqual, assertBool)
25+
import Test.Tasty (defaultMain, testGroup, TestTree)
26+
import Test.Tasty.HUnit (assertEqual, assertBool, testCase)
2827

2928
testKeyBasedRouting :: TestResult Bool -> Process ()
3029
testKeyBasedRouting result = do
@@ -158,10 +157,10 @@ myRemoteTable :: RemoteTable
158157
myRemoteTable =
159158
Control.Distributed.Process.Extras.__remoteTable initRemoteTable
160159

161-
tests :: NT.Transport -> IO [Test]
160+
tests :: NT.Transport -> IO TestTree
162161
tests transport = do
163162
localNode <- newLocalNode transport myRemoteTable
164-
return [
163+
return $ testGroup "" [
165164
testGroup "Event Manager"
166165
[
167166
testCase "Simple Event Handlers"
@@ -187,7 +186,7 @@ main :: IO ()
187186
main = testMain $ tests
188187

189188
-- | Given a @builder@ function, make and run a test suite on a single transport
190-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
189+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
191190
testMain builder = do
192191
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "10501") defaultTCPParameters
193192
testData <- builder transport

packages/distributed-process-execution/tests/TestMailbox.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ import Prelude hiding (drop)
1717

1818
import Data.Maybe (catMaybes)
1919

20-
import Test.Framework as TF (defaultMain, testGroup, Test)
21-
import Test.Framework.Providers.HUnit
22-
import Test.HUnit (assertEqual)
20+
import Test.Tasty (defaultMain, testGroup, TestTree)
21+
import Test.Tasty.HUnit (assertEqual, testCase)
2322

2423
import qualified MailboxTestFilters (__remoteTable)
2524
import MailboxTestFilters (myFilter, intFilter)
@@ -175,11 +174,11 @@ myRemoteTable =
175174
Control.Distributed.Process.Extras.__remoteTable $
176175
MailboxTestFilters.__remoteTable initRemoteTable
177176

178-
tests :: NT.Transport -> IO [Test]
177+
tests :: NT.Transport -> IO TestTree
179178
tests transport = do
180179
{- verboseCheckWithResult stdArgs -}
181180
localNode <- newLocalNode transport myRemoteTable
182-
return [
181+
return $ testGroup "" [
183182
testGroup "Dequeue/Pop Ordering"
184183
[
185184
testCase "Queue Ordering"
@@ -253,7 +252,7 @@ main :: IO ()
253252
main = testMain $ tests
254253

255254
-- | Given a @builder@ function, make and run a test suite on a single transport
256-
testMain :: (NT.Transport -> IO [Test]) -> IO ()
255+
testMain :: (NT.Transport -> IO TestTree) -> IO ()
257256
testMain builder = do
258257
Right (transport, _) <- createTransportExposeInternals (defaultTCPAddr "127.0.0.1" "10501") defaultTCPParameters
259258
testData <- builder transport

packages/distributed-process-extras/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Unreleased
2+
3+
* Ported test suite to use `tasty` rather than `test-framework`.
4+
15
2024-10-30 David Simmons-Duffin <[email protected]> 0.3.8
26

37
* Bump dependency bound for ansi-terminal

0 commit comments

Comments
 (0)