Hello community,

here is the log from the commit of package ghc-fold-debounce-conduit for 
openSUSE:Factory checked in at 2016-11-11 14:35:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-fold-debounce-conduit (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-fold-debounce-conduit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-fold-debounce-conduit"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-fold-debounce-conduit/ghc-fold-debounce-conduit.changes
      2016-11-03 12:59:25.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-fold-debounce-conduit.new/ghc-fold-debounce-conduit.changes
 2016-11-11 14:35:07.000000000 +0100
@@ -1,0 +2,5 @@
+Tue Oct 11 08:50:06 UTC 2016 - [email protected]
+
+- Update to version 0.1.0.4 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  fold-debounce-conduit-0.1.0.2.tar.gz

New:
----
  fold-debounce-conduit-0.1.0.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-fold-debounce-conduit.spec ++++++
--- /var/tmp/diff_new_pack.27Zx6p/_old  2016-11-11 14:35:08.000000000 +0100
+++ /var/tmp/diff_new_pack.27Zx6p/_new  2016-11-11 14:35:08.000000000 +0100
@@ -19,15 +19,14 @@
 %global pkg_name fold-debounce-conduit
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1.0.2
+Version:        0.1.0.4
 Release:        0
 Summary:        Regulate input traffic from conduit Source with 
Control.FoldDebounce
 License:        BSD-3-Clause
-Group:          System/Libraries
+Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
-# Begin cabal-rpm deps:
 BuildRequires:  ghc-conduit-devel
 BuildRequires:  ghc-fold-debounce-devel
 BuildRequires:  ghc-resourcet-devel
@@ -39,7 +38,6 @@
 %if %{with tests}
 BuildRequires:  ghc-hspec-devel
 %endif
-# End cabal-rpm deps
 
 %description
 Regulate input traffic from conduit Source with Control.FoldDebounce.
@@ -60,20 +58,14 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
-
 %check
-%if %{with tests}
-%{cabal} test
-%endif
-
+%cabal_test
 
 %post devel
 %ghc_pkg_recache

++++++ fold-debounce-conduit-0.1.0.2.tar.gz -> 
fold-debounce-conduit-0.1.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fold-debounce-conduit-0.1.0.2/ChangeLog.md 
new/fold-debounce-conduit-0.1.0.4/ChangeLog.md
--- old/fold-debounce-conduit-0.1.0.2/ChangeLog.md      2016-05-22 
04:29:54.000000000 +0200
+++ new/fold-debounce-conduit-0.1.0.4/ChangeLog.md      2016-10-10 
08:30:13.000000000 +0200
@@ -1,5 +1,15 @@
 # Revision history for fold-debounce-conduit
 
+## 0.1.0.4  -- 2016-10-10
+
+* Make the tests more stable.
+
+
+## 0.1.0.3  -- 2016-10-09
+
+* Confirmed build with hspec-2.3.0
+
+
 ## 0.1.0.2  -- 2016-05-22
 
 * Confirmed build with base-4.9.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/fold-debounce-conduit-0.1.0.2/fold-debounce-conduit.cabal 
new/fold-debounce-conduit-0.1.0.4/fold-debounce-conduit.cabal
--- old/fold-debounce-conduit-0.1.0.2/fold-debounce-conduit.cabal       
2016-05-22 04:29:36.000000000 +0200
+++ new/fold-debounce-conduit-0.1.0.4/fold-debounce-conduit.cabal       
2016-10-10 08:29:44.000000000 +0200
@@ -1,5 +1,5 @@
 name:                   fold-debounce-conduit
-version:                0.1.0.2
+version:                0.1.0.4
 author:                 Toshio Ito <[email protected]>
 maintainer:             Toshio Ito <[email protected]>
 license:                BSD3
@@ -46,7 +46,7 @@
   other-modules:        Data.Conduit.FoldDebounceSpec
   build-depends:        base, fold-debounce-conduit, stm,
                         conduit, transformers, resourcet,
-                        hspec >=2.1.7 && <2.3
+                        hspec >=2.1.7 && <2.4
 
 source-repository head
   type:                 git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/fold-debounce-conduit-0.1.0.2/test/Data/Conduit/FoldDebounceSpec.hs 
new/fold-debounce-conduit-0.1.0.4/test/Data/Conduit/FoldDebounceSpec.hs
--- old/fold-debounce-conduit-0.1.0.2/test/Data/Conduit/FoldDebounceSpec.hs     
2016-05-22 04:11:08.000000000 +0200
+++ new/fold-debounce-conduit-0.1.0.4/test/Data/Conduit/FoldDebounceSpec.hs     
2016-10-10 08:29:29.000000000 +0200
@@ -2,17 +2,18 @@
 
 import Test.Hspec
 
-import Data.Maybe (isJust)
-import Data.Monoid (Monoid)
+import Control.Applicative ((<$>))
 import Control.Concurrent (threadDelay, myThreadId)
+import Control.Concurrent.STM (atomically, TVar, newTVarIO, writeTVar, 
readTVar, retry)
 import Control.Monad (forM_, void)
-import System.Timeout (timeout)
-import qualified Data.Conduit.FoldDebounce as F
-import Data.Conduit (Source, ConduitM, ($$), yield, addCleanup)
 import Control.Monad.IO.Class (liftIO)
-import qualified Data.Conduit.List as CL
-import Control.Concurrent.STM (atomically, TVar, newTVarIO, writeTVar, 
readTVar)
 import Control.Monad.Trans.Resource (ResourceT, runResourceT, register)
+import Data.Conduit (Source, ConduitM, ($$), yield, addCleanup)
+import qualified Data.Conduit.FoldDebounce as F
+import qualified Data.Conduit.List as CL
+import Data.Maybe (isJust)
+import Data.Monoid (Monoid)
+import System.Timeout (timeout)
 
 main :: IO ()
 main = hspec spec
@@ -47,6 +48,18 @@
 debMonoid :: Monoid i => Int -> Source (ResourceT IO) i -> Source (ResourceT 
IO) i
 debMonoid delay = F.debounce F.forMonoid F.def { F.delay = delay }
 
+shouldSatisfyEventually :: Int -> TVar a -> (a -> Bool) -> IO ()
+shouldSatisfyEventually timeout_usec got predicate = do
+  eventually_got <- timeout timeout_usec $ atomically $ doCheck
+  fmap predicate eventually_got `shouldBe` Just True
+  where
+    doCheck = do
+      ret <- readTVar got
+      if predicate ret then return ret else retry
+
+shouldSatisfyEventually' :: TVar a -> (a -> Bool) -> IO ()
+shouldSatisfyEventually' = shouldSatisfyEventually 20000000
+
 spec :: Spec
 spec = do
   describe "debounce" $ do
@@ -65,9 +78,8 @@
       let orig_source = detector $ periodicSource 10000 (repeat "a")
       ret <- runResourceT $ debMonoid 50000 orig_source $$ CL.take 4
       length ret `shouldBe` 4
-      forM_ ret (`shouldContain` "aaa")
-      threadDelay 20000
-      atomically (readTVar terminated) `shouldReturn` True
+      forM_ ret (`shouldContain` "a")
+      terminated `shouldSatisfyEventually'` (== True)
     it "should terminate the debounced Source gracefully if the original 
Source throws exception" $ do
       -- For now, the exception in the original Source is not handled,
       -- i.e., we just let it terminate the thread. So we'll see the
@@ -83,8 +95,7 @@
             _ <- error "Exception in retSink"
             return taken
       runResourceT (debMonoid 50000 orig_source $$ ret_sink) `shouldThrow` 
errorCall "Exception in retSink"
-      threadDelay 20000
-      atomically (readTVar terminated) `shouldReturn` True
+      terminated `shouldSatisfyEventually'` (== True)
     it "should connect the original Source in another thread" $ do
       this_thread <- myThreadId
       orig_thread_t <- newTVarIO Nothing
@@ -101,7 +112,7 @@
       (released, orig_source) <- attachResource $ periodicSource 10000 
[1,2,3,4]
       ret <- runResourceT $ debSum 500000 orig_source $$ CL.consume
       ret `shouldBe` [10]
-      atomically (readTVar released) `shouldReturn` True
+      released `shouldSatisfyEventually'` (== True)
     it "should release the resource in the original Source when the downstream 
Sink throws exception" $ do
       (released, orig_source) <- attachResource $ periodicSource 10000 $ 
repeat "a"
       let sink = do
@@ -109,8 +120,7 @@
             _ <- error "Exception in downstream"
             return taken
       runResourceT (debMonoid 500000 orig_source $$ sink) `shouldThrow` 
errorCall "Exception in downstream"
-      threadDelay 20000
-      atomically (readTVar released) `shouldReturn` True
+      released `shouldSatisfyEventually'` (== True)
     it "should release the resource in the original Source when the original 
Source throws exception" $ do
       -- Because the error is not handled, we'll see the error message
       -- while running the test. (See above for the case "original
@@ -118,6 +128,6 @@
       (released, orig_source) <- attachResource (periodicSource 10000 ["a", 
"b"] >> error "Exception in source")
       ret <- runResourceT $ debMonoid 500000 orig_source $$ CL.consume
       ret `shouldBe` ["ab"]
-      atomically (readTVar released) `shouldReturn` True
+      released `shouldSatisfyEventually'` (== True)
 
       


Reply via email to